Skip to content

Commit d4ca979

Browse files
authored
Fix 958: Location filter (#963)
* Fix filter when trying to create a location named the same in different sites * Add regression test for issue 958
1 parent c6df6be commit d4ca979

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

plugins/module_utils/netbox_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@
435435
),
436436
"l2vpn": set(["name"]),
437437
"lag": set(["name"]),
438-
"location": set(["slug"]),
438+
"location": set(["slug", "site"]),
439439
"module_type": set(["model"]),
440440
"manufacturer": set(["slug"]),
441441
"master": set(["name"]),

tests/integration/targets/regression-v3.4/tasks/main.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,21 @@
263263
assert:
264264
that:
265265
- test_results | community.general.json_query('results[?ip_address.address==`1.121.121.121/32`]') | length == 2
266-
- test_results | community.general.json_query('results[?ip_address.address==`121.121.121.121/32`]') | length == 2
266+
- test_results | community.general.json_query('results[?ip_address.address==`121.121.121.121/32`]') | length == 2
267+
268+
- name: "Issue #958 - Make sure we can add same location with different sites"
269+
netbox.netbox.netbox_location:
270+
netbox_url: "http://localhost:32768"
271+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
272+
data:
273+
name: Office Building
274+
site: "{{ item }}"
275+
loop:
276+
- Test Site
277+
- Test Site2
278+
register: test_results
279+
280+
- name: "ASSERT ISSUE #957 - Location has different IDs"
281+
ansible.builtin.assert:
282+
that:
283+
- test_results.results.0.location.id != test_results.results.1.location.id

0 commit comments

Comments
 (0)