Skip to content

Commit 3ccd72a

Browse files
Bugfix: Allow Integers for IDs to be passed into lists. (#409)
1 parent 4cfd2fc commit 3ccd72a

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

plugins/module_utils/netbox_utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,11 @@ def _find_ids(self, data, user_query_params):
840840
temp_dict = self._build_query_params(
841841
k, data, child=norm_data
842842
)
843+
# If user passes in an integer, add to ID list to id_list as user
844+
# should have passed in a tag ID
845+
elif isinstance(list_item, int):
846+
id_list.append(list_item)
847+
continue
843848
query_id = self._nb_endpoint_get(nb_endpoint, temp_dict, k)
844849
if query_id:
845850
id_list.append(query_id.id)

tests/integration/netbox-deploy.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def make_netbox_calls(endpoint, payload):
4141

4242
# Create tags used in future tests
4343
if nb_version >= version.parse("2.9"):
44-
create_tags = nb.extras.tags.create(
44+
create_tags = make_netbox_calls(
45+
nb.extras.tags,
4546
[
4647
{"name": "First", "slug": "first"},
4748
{"name": "Second", "slug": "second"},
@@ -53,7 +54,7 @@ def make_netbox_calls(endpoint, payload):
5354
{"name": "tagB", "slug": "tagb"},
5455
{"name": "tagC", "slug": "tagc"},
5556
{"name": "Updated", "slug": "updated"},
56-
]
57+
],
5758
)
5859

5960
# ORDER OF OPERATIONS FOR THE MOST PART

tests/integration/targets/regression-latest/tasks/main.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,10 @@
148148
status: "Staged"
149149
asset_tag: "Null"
150150
tags:
151-
- slug: second
152-
- slug: third
153-
- slug: first
151+
# Changed these for issue #407 to be IDs
152+
- 2
153+
- 3
154+
- 1
154155
register: test_seven
155156

156157
- name: "5 - Assert added tag - Tests #242 is fixed"

tests/integration/targets/regression-v2.9/tasks/main.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,10 @@
148148
status: "Staged"
149149
asset_tag: "Null"
150150
tags:
151-
- slug: second
152-
- slug: third
153-
- slug: first
151+
# Changed these for issue #407 to be IDs
152+
- 2
153+
- 3
154+
- 1
154155
register: test_seven
155156

156157
- name: "5 - Assert added tag - Tests #242 is fixed"

0 commit comments

Comments
 (0)