mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
parent
8e76da89f2
commit
f47f8abe42
@ -607,7 +607,11 @@ class UnifiedJobSerializer(BaseSerializer):
|
||||
summary_fields = super(UnifiedJobSerializer, self).get_summary_fields(obj)
|
||||
if obj.spawned_by_workflow:
|
||||
summary_fields['source_workflow_job'] = {}
|
||||
summary_obj = obj.unified_job_node.workflow_job
|
||||
try:
|
||||
summary_obj = obj.unified_job_node.workflow_job
|
||||
except ObjectDoesNotExist:
|
||||
return summary_fields
|
||||
|
||||
for field in SUMMARIZABLE_FK_FIELDS['job']:
|
||||
val = getattr(summary_obj, field, None)
|
||||
if val is not None:
|
||||
|
@ -20,6 +20,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.timezone import now
|
||||
from django.utils.encoding import smart_text
|
||||
from django.apps import apps
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
|
||||
# Django-Polymorphic
|
||||
from polymorphic import PolymorphicModel
|
||||
@ -780,13 +781,19 @@ class UnifiedJob(PolymorphicModel, PasswordFieldsModel, CommonModelNameNotUnique
|
||||
@property
|
||||
def workflow_job_id(self):
|
||||
if self.spawned_by_workflow:
|
||||
return self.unified_job_node.workflow_job.pk
|
||||
try:
|
||||
return self.unified_job_node.workflow_job.pk
|
||||
except ObjectDoesNotExist:
|
||||
pass
|
||||
return None
|
||||
|
||||
@property
|
||||
def workflow_node_id(self):
|
||||
if self.spawned_by_workflow:
|
||||
return self.unified_job_node.pk
|
||||
try:
|
||||
return self.unified_job_node.pk
|
||||
except ObjectDoesNotExist:
|
||||
pass
|
||||
return None
|
||||
|
||||
@property
|
||||
|
Loading…
Reference in New Issue
Block a user