mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Fixing up some activity stream deferreds
This commit is contained in:
committed by
Ryan Petrello
parent
6a9bfa74c4
commit
8091b84344
@@ -388,6 +388,9 @@ def activity_stream_create(sender, instance, created, **kwargs):
|
|||||||
# Skip recording any inventory source directly associated with a group.
|
# Skip recording any inventory source directly associated with a group.
|
||||||
if isinstance(instance, InventorySource) and instance.deprecated_group:
|
if isinstance(instance, InventorySource) and instance.deprecated_group:
|
||||||
return
|
return
|
||||||
|
_type = type(instance)
|
||||||
|
if hasattr(_type, '_deferred', False):
|
||||||
|
return
|
||||||
object1 = camelcase_to_underscore(instance.__class__.__name__)
|
object1 = camelcase_to_underscore(instance.__class__.__name__)
|
||||||
changes = model_to_dict(instance, model_serializer_mapping)
|
changes = model_to_dict(instance, model_serializer_mapping)
|
||||||
# Special case where Job survey password variables need to be hidden
|
# Special case where Job survey password variables need to be hidden
|
||||||
@@ -421,6 +424,9 @@ def activity_stream_update(sender, instance, **kwargs):
|
|||||||
changes = model_instance_diff(old, new, model_serializer_mapping)
|
changes = model_instance_diff(old, new, model_serializer_mapping)
|
||||||
if changes is None:
|
if changes is None:
|
||||||
return
|
return
|
||||||
|
_type = type(instance)
|
||||||
|
if hasattr(_type, '_deferred', False):
|
||||||
|
return
|
||||||
object1 = camelcase_to_underscore(instance.__class__.__name__)
|
object1 = camelcase_to_underscore(instance.__class__.__name__)
|
||||||
activity_entry = ActivityStream(
|
activity_entry = ActivityStream(
|
||||||
operation='update',
|
operation='update',
|
||||||
@@ -445,6 +451,9 @@ def activity_stream_delete(sender, instance, **kwargs):
|
|||||||
# 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):
|
if isinstance(instance, Inventory) and not kwargs.get('inventory_delete_flag', False):
|
||||||
return
|
return
|
||||||
|
_type = type(instance)
|
||||||
|
if hasattr(_type, '_deferred', False):
|
||||||
|
return
|
||||||
changes = model_to_dict(instance)
|
changes = model_to_dict(instance)
|
||||||
object1 = camelcase_to_underscore(instance.__class__.__name__)
|
object1 = camelcase_to_underscore(instance.__class__.__name__)
|
||||||
activity_entry = ActivityStream(
|
activity_entry = ActivityStream(
|
||||||
@@ -466,6 +475,9 @@ def activity_stream_associate(sender, instance, **kwargs):
|
|||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
obj1 = instance
|
obj1 = instance
|
||||||
|
_type = type(instance)
|
||||||
|
if hasattr(_type, '_deferred', False):
|
||||||
|
return
|
||||||
object1=camelcase_to_underscore(obj1.__class__.__name__)
|
object1=camelcase_to_underscore(obj1.__class__.__name__)
|
||||||
obj_rel = sender.__module__ + "." + sender.__name__
|
obj_rel = sender.__module__ + "." + sender.__name__
|
||||||
|
|
||||||
@@ -476,6 +488,9 @@ def activity_stream_associate(sender, instance, **kwargs):
|
|||||||
if not obj2_actual.exists():
|
if not obj2_actual.exists():
|
||||||
continue
|
continue
|
||||||
obj2_actual = obj2_actual[0]
|
obj2_actual = obj2_actual[0]
|
||||||
|
_type = type(obj2_actual)
|
||||||
|
if hasattr(_type, '_deferred', False):
|
||||||
|
return
|
||||||
if isinstance(obj2_actual, Role) and obj2_actual.content_object is not None:
|
if isinstance(obj2_actual, Role) and obj2_actual.content_object is not None:
|
||||||
obj2_actual = obj2_actual.content_object
|
obj2_actual = obj2_actual.content_object
|
||||||
object2 = camelcase_to_underscore(obj2_actual.__class__.__name__)
|
object2 = camelcase_to_underscore(obj2_actual.__class__.__name__)
|
||||||
|
|||||||
Reference in New Issue
Block a user