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,7 +520,10 @@ class SSH(object):
# save load to the master job cache # save load to the master job cache
try: try:
self.returners['{0}.save_load'.format(self.opts['master_job_cache'])](jid, job_load) 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: except Exception as exc:
log.error('Could not save load with returner {0}: {1}'.format(self.opts['master_job_cache'], 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 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) jid_dir = _jid_dir(jid)
@ -202,12 +206,13 @@ def save_load(jid, clear_load):
# if you have a tgt, save that for the UI etc # if you have a tgt, save that for the UI etc
if 'tgt' in clear_load: if 'tgt' in clear_load:
ckminions = salt.utils.minions.CkMinions(__opts__) if minions is None:
# Retrieve the minions list ckminions = salt.utils.minions.CkMinions(__opts__)
minions = ckminions.check_minions( # Retrieve the minions list
clear_load['tgt'], minions = ckminions.check_minions(
clear_load.get('tgt_type', 'glob') clear_load['tgt'],
) clear_load.get('tgt_type', 'glob')
)
# save the minions to a cache so we can see in the UI # save the minions to a cache so we can see in the UI
try: try:
serial.dump( serial.dump(