Skip to content

Commit 188f97a

Browse files
committed
Consider tags, tagged_vlans and object_types as set
1 parent 2e25e1f commit 188f97a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
minor_changes:
2+
- In addition to `tags`, also consider `tagged_vlans` and `objects_types` as set for updates and comparision

plugins/module_utils/netbox_utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,9 +1489,13 @@ def _update_netbox_object(self, data):
14891489
updated_obj = serialized_nb_obj.copy()
14901490
updated_obj.update(data)
14911491

1492-
if serialized_nb_obj.get("tags") and data.get("tags"):
1493-
serialized_nb_obj["tags"] = set(serialized_nb_obj["tags"])
1494-
updated_obj["tags"] = set(data["tags"])
1492+
# these fields are considerd a set and should be in sync with pynetbox
1493+
# response object
1494+
list_as_set = ["tags", "tagged_vlans", "object_types"]
1495+
for k in list_as_set:
1496+
if serialized_nb_obj.get(k) and data.get(k):
1497+
serialized_nb_obj[k] = set(serialized_nb_obj[k])
1498+
updated_obj[k] = set(data[k])
14951499

14961500
# Ensure idempotency for site on older netbox versions
14971501
version_pre_30 = self._version_check_greater("3.0", self.version)

0 commit comments

Comments
 (0)