Skip to content

[Bug]: netbox_device module failing if racks have the same name even if they are in different site/region #838

@jsalatiel

Description

@jsalatiel

Ansible NetBox Collection version

v3.8.0

Ansible version

ansible [core 2.11.7]

NetBox version

v3.2.5

Python version

3.8

Steps to Reproduce

Create two sites, site1 and site2
Create two locations under site (site1-loc1, site1-loc2 ) and 1 location under site2 ( site2-loc1)
Create 3 racks and name them all rack01 loke this:
rack1 -> site: site1 , location: site1-loc1
rack1 -> site: site1 , location: site1-loc2
rack1 -> site: site2 , location: site2-loc1

Now try to create a device with rack01 as parameter. ( Also setting site and location for the device )

It will fail complaining about" More than one result returned for rack"

Expected Behavior

It should not fail since I have different sites/locations

Observed Behavior

File "/tmp/ansible_netbox.netbox.netbox_device_payload_krpgp79m/ansible_netbox.netbox.netbox_device_payload.zip/ansible_collections/netbox/netbox/plugins/module_utils/netbox_utils.py", line 700, in _nb_endpoint_get
response = nb_endpoint.get(**query_params)
File "/home/.../.local/lib/python3.8/site-packages/pynetbox/core/endpoint.py", line 153, in get
raise ValueError(

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions