Add update_endtime functionality to salt.utils.job.store_job

This commit is contained in:
Colton Myers 2015-07-16 17:46:44 -06:00
parent 9ed805d631
commit b3134d88ac
2 changed files with 9 additions and 1 deletions

View File

@ -760,7 +760,7 @@ class RemoteFuncs(object):
return
fstr = '{0}.update_endtime'.format(self.opts['master_job_cache'])
if (self.opts.get['job_cache_store_endtime']
if (self.opts.get('job_cache_store_endtime')
and fstr in self.mminion.returners):
self.mminion.returners[fstr](load['jid'], endtime)

View File

@ -18,6 +18,8 @@ def store_job(opts, load, event=None, mminion=None):
'''
Store job information using the configured master_job_cache
'''
# Generate EndTime
endtime = salt.utils.jid.jid_to_time(salt.utils.jid.gen_jid())
# If the return data is invalid, just ignore it
if any(key not in load for key in ('return', 'jid', 'id')):
return False
@ -84,6 +86,12 @@ def store_job(opts, load, event=None, mminion=None):
if 'jid' in load and 'get_load' in mminion.returners and not mminion.returners[getfstr](load.get('jid', '')):
mminion.returners[savefstr](load['jid'], load)
mminion.returners[fstr](load)
updateetfstr = '{0}.update_endtime'.format(job_cache)
if (opts.get('job_cache_store_endtime')
and updateetfstr in mminion.returners):
mminion.returners[updateetfstr](load['jid'], endtime)
except KeyError:
emsg = "Returner '{0}' does not support function returner".format(job_cache)
log.error(emsg)