Primary IP address variable wrong in the Export Template example #4531

Closed
opened 2025-12-29 18:37:02 +01:00 by adam · 3 comments
Owner

Originally created by @bgianpetro on GitHub (Feb 3, 2021).

Change Type

[ ] Addition
[X ] Correction
[ ] Deprecation
[ ] Cleanup (formatting, typos, etc.)

Area

[ ] Installation instructions
[ ] Configuration parameters
[X ] Functionality/features
[ ] REST API
[ ] Administration/development
[ ] Other

In the Export Templates example there is a Jinja2 variable listed as follows:

{{ device.primary_ip.address.ip }}

I believe this is wrong, because it errored out when I used it and was resolved when I removed the trailing '.ip' as follows:

{{ device.primary_ip.address }}

Originally created by @bgianpetro on GitHub (Feb 3, 2021). <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. Please indicate the nature of the change by placing an X in one of the boxes below. --> ### Change Type [ ] Addition [X ] Correction [ ] Deprecation [ ] Cleanup (formatting, typos, etc.) ### Area [ ] Installation instructions [ ] Configuration parameters [X ] Functionality/features [ ] REST API [ ] Administration/development [ ] Other <!-- Describe the proposed change(s). --> In the Export Templates example there is a Jinja2 variable listed as follows: {{ device.primary_ip.address.ip }} I believe this is wrong, because it errored out when I used it and was resolved when I removed the trailing '.ip' as follows: {{ device.primary_ip.address }}
adam closed this issue 2025-12-29 18:37:02 +01:00
Author
Owner

@DanSheps commented on GitHub (Feb 4, 2021):

Do you remember the error? .address is a IP Address Object from the netaddr library

@DanSheps commented on GitHub (Feb 4, 2021): Do you remember the error? .address is a IP Address Object from the netaddr library
Author
Owner

@bgianpetro commented on GitHub (Feb 4, 2021):

Right, but note that as documented it is '.address.ip' (not just '.address')

So here's the error I receive if I keep the '.ip':

There was an error rendering the selected export template (test): 'None' has no attribute 'address'

@bgianpetro commented on GitHub (Feb 4, 2021): Right, but note that as documented it is '.address.ip' (not just '.address') So here's the error I receive if I keep the '.ip': There was an error rendering the selected export template (test): 'None' has no attribute 'address'
Author
Owner

@jeremystretch commented on GitHub (Feb 4, 2021):

The example provided in the documentation is just that: an example. It is provided merely for illustration and is not intended to be used directly. We don't need to be certain the example code will work in every situation.

@jeremystretch commented on GitHub (Feb 4, 2021): The example provided in the documentation is just that: an example. It is provided merely for illustration and is not intended to be used directly. We don't need to be certain the example code will work in every situation.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4531