mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 19:07:39 -02:30
Merge pull request #2641 from anoek/2515
Don't update computed fields while mass group deleting until the end
This commit is contained in:
@@ -221,6 +221,8 @@ def migrate_children_from_deleted_group_to_parent_groups(sender, **kwargs):
|
|||||||
parents_pks = getattr(instance, '_saved_parents_pks', [])
|
parents_pks = getattr(instance, '_saved_parents_pks', [])
|
||||||
hosts_pks = getattr(instance, '_saved_hosts_pks', [])
|
hosts_pks = getattr(instance, '_saved_hosts_pks', [])
|
||||||
children_pks = getattr(instance, '_saved_children_pks', [])
|
children_pks = getattr(instance, '_saved_children_pks', [])
|
||||||
|
is_updating = getattr(_inventory_updates, 'is_updating', False)
|
||||||
|
|
||||||
with ignore_inventory_group_removal():
|
with ignore_inventory_group_removal():
|
||||||
with ignore_inventory_computed_fields():
|
with ignore_inventory_computed_fields():
|
||||||
if parents_pks:
|
if parents_pks:
|
||||||
@@ -234,7 +236,7 @@ def migrate_children_from_deleted_group_to_parent_groups(sender, **kwargs):
|
|||||||
child_group, parent_group)
|
child_group, parent_group)
|
||||||
parent_group.children.add(child_group)
|
parent_group.children.add(child_group)
|
||||||
inventory_pk = getattr(instance, '_saved_inventory_pk', None)
|
inventory_pk = getattr(instance, '_saved_inventory_pk', None)
|
||||||
if inventory_pk:
|
if inventory_pk and not is_updating:
|
||||||
try:
|
try:
|
||||||
inventory = Inventory.objects.get(pk=inventory_pk)
|
inventory = Inventory.objects.get(pk=inventory_pk)
|
||||||
inventory.update_computed_fields()
|
inventory.update_computed_fields()
|
||||||
|
|||||||
Reference in New Issue
Block a user