Fix creation of jobs with stopped state

Freezer-scheduler correctly creates the stopped jobs with stop event
instead of autostarting the job.

Change-Id: I589fa3127f33fffc469c85afd1e1c4b0bfc8a5bf
Closes-Bug: #1563415
This commit is contained in:
Saad Zaher 2016-03-29 17:30:09 +01:00
parent 3497834323
commit 367a225bcf

View File

@ -135,8 +135,10 @@ class Job(object):
if job.job_doc_status in ['running', 'scheduled']: if job.job_doc_status in ['running', 'scheduled']:
logging.warning('Resetting {0} status from job {1}' logging.warning('Resetting {0} status from job {1}'
.format(job.job_doc_status, job.id)) .format(job.job_doc_status, job.id))
job.job_doc_status = '' if job.job_doc_status == 'stop' and not job.event:
if not job.event: logging.info('Job {0} was stopped.'.format(job.id))
job.event = Job.STOP_EVENT
elif not job.event:
logging.info('Autostart Job {0}'.format(job.id)) logging.info('Autostart Job {0}'.format(job.id))
job.event = Job.START_EVENT job.event = Job.START_EVENT
return job return job