Skip to content

Commit f710998

Browse files
authored
Use the individual list items rather than the whole list when looking for objects in netbox (#570)
* Fix for #569
1 parent 8381c5a commit f710998

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

plugins/module_utils/netbox_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ def _find_ids(self, data, user_query_params):
10051005
id_list.append(list_item)
10061006
continue
10071007
else:
1008-
temp_dict = {QUERY_TYPES.get(k, "q"): search}
1008+
temp_dict = {QUERY_TYPES.get(k, "q"): list_item}
10091009

10101010
query_id = self._nb_endpoint_get(nb_endpoint, temp_dict, k)
10111011
if query_id:

tests/integration/targets/v2.10/tasks/netbox_vrf.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
description: Updated description
7171
import_targets:
7272
- "4000:4000"
73+
- "5000:5000"
7374
export_targets:
7475
- "5000:5000"
7576
tags:
@@ -85,15 +86,15 @@
8586
- test_four['diff']['after']['enforce_unique'] == false
8687
- test_four['diff']['after']['description'] == "Updated description"
8788
- test_four['diff']['after']['tags'][0] == 4
88-
- test_four['diff']['after']['import_targets'] | length == 1
89+
- test_four['diff']['after']['import_targets'] | length == 2
8990
- test_four['diff']['after']['export_targets'] | length == 1
9091
- test_four['vrf']['name'] == "Test VRF One"
9192
- test_four['vrf']['tenant'] == 1
9293
- test_four['vrf']['rd'] == "65001:1"
9394
- test_four['vrf']['enforce_unique'] == false
9495
- test_four['vrf']['description'] == "Updated description"
9596
- test_four['vrf']['tags'][0] == 4
96-
- test_four['vrf']['import_targets'] | length == 1
97+
- test_four['vrf']['import_targets'] | length == 2
9798
- test_four['vrf']['export_targets'] | length == 1
9899
- test_four['msg'] == "vrf Test VRF One updated"
99100

tests/integration/targets/v2.11/tasks/netbox_vrf.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
description: Updated description
7171
import_targets:
7272
- "4000:4000"
73+
- "5000:5000"
7374
export_targets:
7475
- "5000:5000"
7576
tags:
@@ -85,15 +86,15 @@
8586
- test_four['diff']['after']['enforce_unique'] == false
8687
- test_four['diff']['after']['description'] == "Updated description"
8788
- test_four['diff']['after']['tags'][0] == 4
88-
- test_four['diff']['after']['import_targets'] | length == 1
89+
- test_four['diff']['after']['import_targets'] | length == 2
8990
- test_four['diff']['after']['export_targets'] | length == 1
9091
- test_four['vrf']['name'] == "Test VRF One"
9192
- test_four['vrf']['tenant'] == 1
9293
- test_four['vrf']['rd'] == "65001:1"
9394
- test_four['vrf']['enforce_unique'] == false
9495
- test_four['vrf']['description'] == "Updated description"
9596
- test_four['vrf']['tags'][0] == 4
96-
- test_four['vrf']['import_targets'] | length == 1
97+
- test_four['vrf']['import_targets'] | length == 2
9798
- test_four['vrf']['export_targets'] | length == 1
9899
- test_four['msg'] == "vrf Test VRF One updated"
99100

0 commit comments

Comments
 (0)