mirror of
https://github.com/ansible/awx.git
synced 2026-01-22 15:08:03 -03:30
Fix an activity stream associate with deleted obj
In some scenarios the activity stream associate could be invoked where obj2 doesn't exist... the .get() will fail and tank the caller preventing the save. This guards that and blocks the activity stream event, saving the save (whew!)
This commit is contained in:
parent
52997ae0ac
commit
4c7f54cf72
@ -410,7 +410,10 @@ def activity_stream_associate(sender, instance, **kwargs):
|
||||
for entity_acted in kwargs['pk_set']:
|
||||
obj2 = kwargs['model']
|
||||
obj2_id = entity_acted
|
||||
obj2_actual = obj2.objects.get(id=obj2_id)
|
||||
obj2_actual = obj2.objects.filter(id=obj2_id)
|
||||
if not obj2_actual.exists():
|
||||
continue
|
||||
obj2_actual = obj2_actual[0]
|
||||
if isinstance(obj2_actual, Role) and obj2_actual.content_object is not None:
|
||||
obj2_actual = obj2_actual.content_object
|
||||
object2 = camelcase_to_underscore(obj2_actual.__class__.__name__)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user