1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

finished fixing job through workflow node

related to #4182
This commit is contained in:
Chris Meyers 2016-12-05 13:29:59 -05:00
parent 8e76da89f2
commit f47f8abe42
2 changed files with 14 additions and 3 deletions

View File

@ -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'] = {}
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:

View File

@ -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:
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:
try:
return self.unified_job_node.pk
except ObjectDoesNotExist:
pass
return None
@property