mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 19:37:38 -02:30
avoid a race condition in recording deletions in the activity stream
1. You delete something. 2. A signal is generated to record an activity stream deletion. 3. The process of deleting that activity stream deletion attempts to look up a related field which has been deleted (in the meantime) via a cascade. see: #6721 see: #7022
This commit is contained in:
@@ -21,6 +21,7 @@ import tempfile
|
|||||||
from decorator import decorator
|
from decorator import decorator
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.db.models.fields.related import ForeignObjectRel, ManyToManyField
|
from django.db.models.fields.related import ForeignObjectRel, ManyToManyField
|
||||||
|
|
||||||
@@ -354,7 +355,10 @@ def model_to_dict(obj, serializer_mapping=None):
|
|||||||
for field in obj._meta.fields:
|
for field in obj._meta.fields:
|
||||||
if field.name not in allowed_fields:
|
if field.name not in allowed_fields:
|
||||||
continue
|
continue
|
||||||
attr_d[field.name] = _convert_model_field_for_display(obj, field.name, password_fields=password_fields)
|
try:
|
||||||
|
attr_d[field.name] = _convert_model_field_for_display(obj, field.name, password_fields=password_fields)
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
logger.warn(_('%s no longer exists for %s') % (field.name, obj))
|
||||||
|
|
||||||
return attr_d
|
return attr_d
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user