mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 15:36:04 -03:30
fix a bug which can break the schedules list endpoint
see: https://github.com/ansible/ansible-tower/issues/7881 related: https://github.com/ansible/awx/pull/1095
This commit is contained in:
@@ -3946,11 +3946,14 @@ class ScheduleSerializer(LaunchConfigurationBaseSerializer, SchedulePreviewSeria
|
|||||||
))
|
))
|
||||||
if obj.unified_job_template:
|
if obj.unified_job_template:
|
||||||
res['unified_job_template'] = obj.unified_job_template.get_absolute_url(self.context.get('request'))
|
res['unified_job_template'] = obj.unified_job_template.get_absolute_url(self.context.get('request'))
|
||||||
if obj.unified_job_template.project:
|
try:
|
||||||
res['project'] = obj.unified_job_template.project.get_absolute_url(self.context.get('request'))
|
if obj.unified_job_template.project:
|
||||||
|
res['project'] = obj.unified_job_template.project.get_absolute_url(self.context.get('request'))
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
pass
|
||||||
if obj.inventory:
|
if obj.inventory:
|
||||||
res['inventory'] = obj.inventory.get_absolute_url(self.context.get('request'))
|
res['inventory'] = obj.inventory.get_absolute_url(self.context.get('request'))
|
||||||
elif obj.unified_job_template and obj.unified_job_template.inventory:
|
elif obj.unified_job_template and getattr(obj.unified_job_template, 'inventory', None):
|
||||||
res['inventory'] = obj.unified_job_template.inventory.get_absolute_url(self.context.get('request'))
|
res['inventory'] = obj.unified_job_template.inventory.get_absolute_url(self.context.get('request'))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user