Sidarion / netbox-joined-inventory

Netbox_joined_inventory is a python script that gathers data from a Netbox source-of-truth and stores them as Ansible inventory, group_vars and host_vars files.
GNU General Public License v3.0
22 stars 12 forks source link

Pagination limit reached #2

Open Dome17 opened 5 years ago

Dome17 commented 5 years ago

On line 281 in the netbox-joined inventory script the pagination limit is generally set to 256: api_url_params['limit'] = 256

When we updated Netbox to the latest version (v.2.5.13), the script didn't work anymore and hanged itself while reading the interfaces of a switch. As already mentioned, the source of the error was the too low limit of 256.

The reason was, that not all interfaces were read by the script as the limit seems to be too small after the upgrade. Missing interfaces lead to a "KEY-Error".

When we raised the limit to 1000, the script worked fine again. (Pagination Max 1000)

However, I am of the opinion that this error could also have occurred inconspicuously, which would have resulted in a misconfiguration of the interfaces. Could the limit of 1000 be exceeded at some point without immediately noticing this in order to avoid misconfiguration? Or can I rely on this limit being sufficient?

Would be great if you could take a look at this failure. Thank you very much.

ypid commented 4 years ago

This issue does not exist with Netbox 2.8 anymore, at least to my understanding. This script uses the default maximum of 1000 and makes subsequent requests if more than 1000 entries exist. I tested this by setting the script limit to 4. The exact same output is generated. All good. Also note that there are two settings: MAX_PAGE_SIZE and PAGINATE_COUNT.

This can be closed.