mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 18:51:06 -03:30
Fix an issue where extra data wasn't being passed down to system jobs
from the schedules
This commit is contained in:
@@ -1003,6 +1003,24 @@ class SystemJob(UnifiedJob, SystemJobOptions):
|
|||||||
def is_blocked_by(self, obj):
|
def is_blocked_by(self, obj):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def handle_extra_data(self, extra_data):
|
||||||
|
extra_vars = {}
|
||||||
|
if type(extra_data) == dict:
|
||||||
|
extra_vars = extra_data
|
||||||
|
elif extra_data is None:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
if extra_data == "":
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
extra_vars = json.loads(extra_data)
|
||||||
|
except Exception, e:
|
||||||
|
logger.warn("Exception deserializing extra vars: " + str(e))
|
||||||
|
evars = self.extra_vars_dict
|
||||||
|
evars.update(extra_vars)
|
||||||
|
self.update_fields(extra_vars=json.dumps(evars))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def task_impact(self):
|
def task_impact(self):
|
||||||
return 150
|
return 150
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ def tower_periodic_scheduler(self):
|
|||||||
logger.warn("Cache timeout is in the future, bypassing schedule for template %s" % str(template.id))
|
logger.warn("Cache timeout is in the future, bypassing schedule for template %s" % str(template.id))
|
||||||
continue
|
continue
|
||||||
new_unified_job = template.create_unified_job(launch_type='scheduled', schedule=schedule)
|
new_unified_job = template.create_unified_job(launch_type='scheduled', schedule=schedule)
|
||||||
can_start = new_unified_job.signal_start(**schedule.extra_data)
|
can_start = new_unified_job.signal_start(extra_vars=schedule.extra_data)
|
||||||
if not can_start:
|
if not can_start:
|
||||||
new_unified_job.status = 'failed'
|
new_unified_job.status = 'failed'
|
||||||
new_unified_job.job_explanation = "Scheduled job could not start because it was not in the right state or required manual credentials"
|
new_unified_job.job_explanation = "Scheduled job could not start because it was not in the right state or required manual credentials"
|
||||||
|
|||||||
Reference in New Issue
Block a user