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.
This commit is contained in:
Rebeccah 2020-02-28 15:40:51 -05:00
parent d3fa34c665
commit e11ff69f3e

View File

@ -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: