mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Fix some invalid assumptions about hosts and jobs where we assume a job
template will always be available
This commit is contained in:
parent
788cf2e24e
commit
8d78755ef4
@ -756,7 +756,11 @@ class HostSerializer(BaseSerializerWithVariables):
|
||||
d['last_job']['job_template_name'] = obj.last_job.job_template.name
|
||||
except (KeyError, AttributeError):
|
||||
pass
|
||||
d.update({'recent_jobs': [{'id': j.job.id, 'name': j.job.job_template.name, 'status': j.job.status,
|
||||
if j.job.job_template is not None:
|
||||
job_template_name = j.job.job_template.name
|
||||
else:
|
||||
job_template_name = ""
|
||||
d.update({'recent_jobs': [{'id': j.job.id, 'name': job_template_name, 'status': j.job.status,
|
||||
'finished': j.job.finished} for j in obj.job_host_summaries.all().order_by('-created')[:5]]})
|
||||
return d
|
||||
|
||||
|
||||
@ -259,7 +259,7 @@ class Job(UnifiedJob, JobOptions):
|
||||
def is_blocked_by(self, obj):
|
||||
from awx.main.models import InventoryUpdate, ProjectUpdate
|
||||
if type(obj) == Job:
|
||||
if obj.job_template == self.job_template:
|
||||
if obj.job_template is not None and obj.job_template == self.job_template:
|
||||
if obj.launch_type == 'callback' and self.launch_type == 'callback':
|
||||
if obj.limit != self.limit:
|
||||
return False
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user