-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the applicationIntroduction of new functionality to the application
Description
NetBox version
v2.11.7
Feature type
Change to existing functionality
Proposed functionality
Include the slug field in object details
Use case
When using the nb_lookup plugin for Ansible, when querying a prefix out of NetBox, based on a role attribute, people sometimes forget that while role is a string parameter in the REST API, it is not the Name attribute of the role, but actually the slug attribute.
This code doesn't work, and causes developer confusion
virtual_edge_tep_ipv4_nw: "{{ lookup('netbox.netbox.nb_lookup', 'prefixes',
api_filter='site=' + netbox_site_slug +
' tag=' + az_name + ' role=' + '\"NSX-T Virtual Edge Tep\"' +
' family=4' + ' vlan_vid=401',
api_endpoint=netbox_url,
token=netbox_token) }}""msg": "An unhandled exception occurred while running the lookup plugin 'netbox.netbox.nb_lookup'.
Error was a <class 'pynetbox.core.query.RequestError'>, original message:
The request failed with code 400 Bad Request: {'role': ['Select a valid choice. NSX-T Virtual Edge Tep is not one of the available choices.']}"
Using the role's slug value works.
virtual_edge_tep_ipv4_nw: "{{ lookup('netbox.netbox.nb_lookup', 'prefixes',
api_filter='site=' + netbox_site_slug +
' tag=' + az_name + ' role=' + 'nsx-t-virtual-edge-tep' +
' family=4' + ' vlan_vid=401',
api_endpoint=netbox_url,
token=netbox_token) }}"So, it would be helpful if the NetBox UI listed the slug attribute in each object detail page, so that I don't have to log into netbox, find the prefix, and click the "Edit" button so I can see the slug
Database changes
No response
External dependencies
No response
Metadata
Metadata
Assignees
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the applicationIntroduction of new functionality to the application