From e11ff69f3e03e0b9b1d7aa205d577a500eb1e336 Mon Sep 17 00:00:00 2001 From: Rebeccah Date: Fri, 28 Feb 2020 15:40:51 -0500 Subject: [PATCH] Added in check for the unified_job_template_id attribute to be present and populated in the object. For anyone reading this later, know that AdHocCommands still have unified_job_template and unified_job_template_id fields, they are just nonetypes because they don't get used by the AdHocCommand objects. Which means you have to actually get the object, not just check that it's there, to use it the way I am in this change. --- awx/main/models/unified_jobs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/main/models/unified_jobs.py b/awx/main/models/unified_jobs.py index 9f4df503e7..b816c49f26 100644 --- a/awx/main/models/unified_jobs.py +++ b/awx/main/models/unified_jobs.py @@ -1222,7 +1222,8 @@ class UnifiedJob(PolymorphicModel, PasswordFieldsModel, CommonModelNameNotUnique status_data['finished'] = self.finished status_data.update(self.websocket_emit_data()) status_data['group_name'] = 'jobs' - status_data['unified_job_template_id'] = self.unified_job_template.id + if getattr(self, 'unified_job_template_id', None): + status_data['unified_job_template_id'] = self.unified_job_template_id emit_channel_notification('jobs-status_changed', status_data) if self.spawned_by_workflow: