diff --git a/awx/main/management/commands/inventory_import.py b/awx/main/management/commands/inventory_import.py index 4f2b75b5fa..9416f070d0 100644 --- a/awx/main/management/commands/inventory_import.py +++ b/awx/main/management/commands/inventory_import.py @@ -523,7 +523,7 @@ class Command(NoArgsCommand): del_groups = del_groups.exclude(name__in=self.all_group.all_groups.keys()) for group in del_groups: group_name = group.name - group.mark_inactive() + group.mark_inactive(recompute=False) self.logger.info('Group "%s" deleted', group_name) # If overwrite is set, clear all invalid child relationships for groups diff --git a/awx/main/signals.py b/awx/main/signals.py index 37b1923f3b..450a688034 100644 --- a/awx/main/signals.py +++ b/awx/main/signals.py @@ -143,7 +143,7 @@ def migrate_children_from_deleted_group_to_parent_groups(sender, **kwargs): except Inventory.DoesNotExist: pass -@receiver(pre_save, sender=Group) +receiver(pre_save, sender=Group) def save_related_pks_before_group_marked_inactive(sender, **kwargs): if getattr(_inventory_updates, 'is_removing', False): return @@ -187,6 +187,7 @@ def migrate_children_from_inactive_group_to_parent_groups(sender, **kwargs): except InventorySource.DoesNotExist: pass inventory_pk = getattr(instance, '_saved_inventory_pk', None) + if not getattr(_inventory_updates, 'is_updating', False): if inventory_pk: try: inventory = Inventory.objects.get(pk=inventory_pk, active=True)