diff --git a/netbox_awx_plugin/synchronization.py b/netbox_awx_plugin/synchronization.py index 16ab5641ac35eb8b76521fa32443febe8023bc27..2e727b1692131b45ffd1da8ef579e28fbc170cec 100644 --- a/netbox_awx_plugin/synchronization.py +++ b/netbox_awx_plugin/synchronization.py @@ -96,7 +96,7 @@ def sync_host(inventory, sender, instance): else: logger.error(f"Invalid data for host_serializer: {host_serializer.errors}") - if len(host["summary_fields"]["groups"]["results"]) > host["summary_fields"]["groups"]["count"]: + if host["summary_fields"]["groups"]["count"] > len(host["summary_fields"]["groups"]["results"]): current_groups = inventory.get_host_groups(host['id']) else: current_groups = host["summary_fields"]["groups"]["results"]