mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 06:26:00 -03:30
Merge pull request #2572 from AlanCoding/coalesce
Coalesce host and group Activity Stream deletion entries Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
@@ -487,12 +487,21 @@ def activity_stream_delete(sender, instance, **kwargs):
|
|||||||
# If we trigger this handler there we may fall into db-integrity-related race conditions.
|
# If we trigger this handler there we may fall into db-integrity-related race conditions.
|
||||||
# So we add flag verification to prevent normal signal handling. This funciton will be
|
# So we add flag verification to prevent normal signal handling. This funciton will be
|
||||||
# explicitly called with flag on in Inventory.schedule_deletion.
|
# explicitly called with flag on in Inventory.schedule_deletion.
|
||||||
if isinstance(instance, Inventory) and not kwargs.get('inventory_delete_flag', False):
|
changes = {}
|
||||||
return
|
if isinstance(instance, Inventory):
|
||||||
|
if not kwargs.get('inventory_delete_flag', False):
|
||||||
|
return
|
||||||
|
# Add additional data about child hosts / groups that will be deleted
|
||||||
|
changes['coalesced_data'] = {
|
||||||
|
'hosts_deleted': instance.hosts.count(),
|
||||||
|
'groups_deleted': instance.groups.count()
|
||||||
|
}
|
||||||
|
elif isinstance(instance, (Host, Group)) and instance.inventory.pending_deletion:
|
||||||
|
return # accounted for by inventory entry, above
|
||||||
_type = type(instance)
|
_type = type(instance)
|
||||||
if getattr(_type, '_deferred', False):
|
if getattr(_type, '_deferred', False):
|
||||||
return
|
return
|
||||||
changes = model_to_dict(instance)
|
changes.update(model_to_dict(instance))
|
||||||
object1 = camelcase_to_underscore(instance.__class__.__name__)
|
object1 = camelcase_to_underscore(instance.__class__.__name__)
|
||||||
if type(instance) == OAuth2AccessToken:
|
if type(instance) == OAuth2AccessToken:
|
||||||
changes['token'] = CENSOR_VALUE
|
changes['token'] = CENSOR_VALUE
|
||||||
|
|||||||
Reference in New Issue
Block a user