Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelogs/fragments/1479-fix-services_parent_object.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
bugfixes:
- add parent_object_type and parent_object_id to services ALLOWED_QUERY_PARAMS
minor_changes:
- add workaround to _build_query_params for services and Netbox 4.3.0 - 4.4.3 (wrong parent_object_type data type)
21 changes: 20 additions & 1 deletion plugins/module_utils/netbox_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,17 @@
"rir": set(["slug"]),
"role": set(["slug"]),
"route_target": set(["name"]),
"services": set(["device", "virtual_machine", "name", "port", "protocol"]),
"services": set(
[
"device",
"virtual_machine",
"name",
"port",
"protocol",
"parent_object_type",
"parent_object_id",
]
),
"service_template": set(["name"]),
"site": set(["slug", "name"]),
"site_group": set(["slug"]),
Expand Down Expand Up @@ -1187,6 +1197,15 @@ def _build_query_params(
query_dict["device_type_id"] = query_dict.pop("device_type")
else:
query_dict["devicetype_id"] = query_dict.pop("device_type")
# TODO workaround for Netbox 4.3.0 - 4.4.3 - #20554
# Remove 'elif parent == "services":' block after support for
# Netbox 4.3.0 - 4.4.3 is removed
elif parent == "services":
if self._version_check_greater(
self.version, "4.3", greater_or_equal=True
) and self._version_check_greater("4.4.4", self.full_version):
query_dict.pop("parent_object_id", None)
query_dict.pop("parent_object_type", None)

if not query_dict:
provided_kwargs = child.keys() if child else module_data.keys()
Expand Down
Loading