From 2a4cb81bc1a8405347206a8043a6525974ee4407 Mon Sep 17 00:00:00 2001 From: Jeremiah Millay Date: Tue, 3 Oct 2023 00:55:02 -0400 Subject: [PATCH] fix: use 'role' instead of 'device_role' with netbox >= 3.6.0 in netbox_device module --- plugins/module_utils/netbox_dcim.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/module_utils/netbox_dcim.py b/plugins/module_utils/netbox_dcim.py index c83c393bf..d0dc0d813 100644 --- a/plugins/module_utils/netbox_dcim.py +++ b/plugins/module_utils/netbox_dcim.py @@ -210,6 +210,13 @@ def run(self): nb_endpoint, object_query_params, name ) + if ( + self.endpoint == "devices" + and data.get("device_role") + and Version(self.full_version) >= Version("3.6.0") + ): + data["role"] = data.pop("device_role") + # This is logic to handle interfaces on a VC if self.endpoint == "interfaces" and self.nb_object: child = self.nb.dcim.devices.get(self.nb_object.device.id)