Fix an issue where extra data wasn't being passed down to system jobs

from the schedules
This commit is contained in:
Matthew Jones 2015-01-26 15:31:57 -05:00
parent 698b58e19f
commit de429ac683
2 changed files with 19 additions and 1 deletions

View File

@ -1003,6 +1003,24 @@ class SystemJob(UnifiedJob, SystemJobOptions):
def is_blocked_by(self, obj):
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
def task_impact(self):
return 150

View File

@ -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))
continue
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:
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"