fix scheduler job removal when api not available

When using the api service, the scheduler fetches the
list of jobs from the api.
When the api communication fails the jobs were erroneously
removed anymore.
This does not happen anymore

Change-Id: Id5323c68dfc8b9c420a4b3f7b16b618c2f5699ce
Closes-Bug: #1482610
This commit is contained in:
Fabrizio Vanni 2015-08-10 17:15:13 +01:00
parent bd81c12e0a
commit 9df765a963

@ -67,12 +67,7 @@ class FreezerScheduler(object):
def get_jobs(self):
if self.client:
job_doc_list = []
try:
job_doc_list = utils.get_active_jobs_from_api(self.client)
except Exception as e:
logging.error('Unable to get jobs from freezer api service. '
'{0}'.format(e))
job_doc_list = utils.get_active_jobs_from_api(self.client)
try:
utils.save_jobs_to_disk(job_doc_list, self.job_path)
except Exception as e:
@ -130,11 +125,11 @@ class FreezerScheduler(object):
return job
def poll(self):
work_job_doc_list = []
try:
work_job_doc_list = self.get_jobs()
except Exception as e:
logging.error("[*] Unable to get jobs: {0}".format(e))
return
work_job_id_list = []