Properly save minion list in local_cache for ssh jobs

This commit is contained in:
Colton Myers 2015-11-18 13:01:56 -07:00
parent 4b1bf7d5e2
commit bd8487b3b9
2 changed files with 16 additions and 8 deletions

View File

@ -520,6 +520,9 @@ class SSH(object):
# save load to the master job cache
try:
if self.opts['master_job_cache'] == 'local_cache':
self.returners['{0}.save_load'.format(self.opts['master_job_cache'])](jid, job_load, minions=self.targets.keys())
else:
self.returners['{0}.save_load'.format(self.opts['master_job_cache'])](jid, job_load)
except Exception as exc:
log.error('Could not save load with returner {0}: {1}'.format(self.opts['master_job_cache'], exc))

View File

@ -173,9 +173,13 @@ def returner(load):
)
def save_load(jid, clear_load):
def save_load(jid, clear_load, minions=None):
'''
Save the load to the specified jid
minions argument is to provide a pre-computed list of matched minions for
the job, for cases when this function can't compute that list itself (such
as for salt-ssh)
'''
jid_dir = _jid_dir(jid)
@ -202,6 +206,7 @@ def save_load(jid, clear_load):
# if you have a tgt, save that for the UI etc
if 'tgt' in clear_load:
if minions is None:
ckminions = salt.utils.minions.CkMinions(__opts__)
# Retrieve the minions list
minions = ckminions.check_minions(