You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a site already exists in NetBox with a building and a floor and we then try to add another site with the same name for the building and the floor fails.
It does work if I change the line "parent_location": set(["slug"]), to "parent_location": set("name", "slug", "site"])
on line 501 in plugins/module_utils/netbox_utils.py and then make the parent_location into a dictionary as shown below.
locations__configured_locations:
name: Building Y
site: demo
name: Floor 36
site: demo
parent_location: <-- make it a dictionary
name: Building Y
site: demo
Ansible NetBox Collection version
v.3.18.0
Ansible version
NetBox version
v3.7.3
Python version
3.10
Steps to Reproduce
If a site already exists in NetBox with a building and a floor and we then try to add another site with the same name for the building and the floor fails.
It does work if I change the line "parent_location": set(["slug"]), to "parent_location": set("name", "slug", "site"])
on line 501 in plugins/module_utils/netbox_utils.py and then make the parent_location into a dictionary as shown below.
locations__configured_locations:
name: Building Y
site: demo
name: Floor 36
site: demo
parent_location: <-- make it a dictionary
name: Building Y
site: demo
name: locations
netbox.netbox.netbox_location:
netbox_url: "{{ lookup('env', 'NETBOX_URL') }}"
netbox_token: "{{ lookup('env', 'NETBOX_TOKEN') }}"
data: "{{ item }}"
state: "{{ desired_state }}"
loop: "{{ locations__configured_locations }}"
Expected Behavior
I expect that different buildings on different sites should be able to have floors with the same name.
Observed Behavior
failed: [localhost] (item={'name': 'Floor 36', 'site': 'demo', 'parent_location': 'Building Y'}) => {"ansible_loop_var": "item", "changed": false, "item": {"name": "Floor 36", "parent_location": "Building Y", "site": "demo"}, "msg": "More than one result returned for parent_location"}
The text was updated successfully, but these errors were encountered: