diff --git a/plugins/module_utils/dnac.py b/plugins/module_utils/dnac.py index 90e2e438b..74e0b42ba 100644 --- a/plugins/module_utils/dnac.py +++ b/plugins/module_utils/dnac.py @@ -870,6 +870,12 @@ def assign_device_to_site(self, device_ids, site_name, site_id): Assigns the specified devices to the site. If the assignment is successful, returns True. Otherwise, logs an error and returns False along with error details. """ + site_response = self.get_site(site_name) + if site_response.get("response") and site_response["response"][0].get("type"): + site_type = site_response["response"][0].get("type") + if site_type not in ("building", "floor"): + self.msg = "Device(s) can only be assigned to building/floor" + self.set_operation_result("failed", False, self.msg, "ERROR").check_return_status() if self.get_ccc_version_as_integer() <= self.get_ccc_version_as_int_from_str("2.3.5.3"): try: