Merge pull request #15679 from thatch45/ssh_static

Add --static to salt-ssh
This commit is contained in:
Thomas S Hatch 2014-09-11 16:48:49 -06:00
commit 16939408f8
2 changed files with 21 additions and 4 deletions

View File

@ -451,12 +451,17 @@ class SSH(object):
print(msg) print(msg)
print('-' * len(msg) + '\n') print('-' * len(msg) + '\n')
print('') print('')
sret = {}
outputter = self.opts.get('output', 'nested')
for ret in self.handle_ssh(): for ret in self.handle_ssh():
host = ret.keys()[0] host = ret.keys()[0]
self.cache_job(jid, host, ret[host]) self.cache_job(jid, host, ret[host])
ret = self.key_deploy(host, ret) ret = self.key_deploy(host, ret)
outputter = ret[host].get('out', self.opts.get('output', 'nested')) outputter = ret[host].get('out', self.opts.get('output', 'nested'))
p_data = {host: ret[host].get('return', {})} p_data = {host: ret[host].get('return', {})}
if self.opts.get('static'):
sret.update(p_data)
else:
salt.output.display_output( salt.output.display_output(
p_data, p_data,
outputter, outputter,
@ -467,6 +472,11 @@ class SSH(object):
salt.utils.event.tagify( salt.utils.event.tagify(
[jid, 'ret', host], [jid, 'ret', host],
'job')) 'job'))
if self.opts.get('static'):
salt.output.display_output(
sret,
outputter,
self.opts)
class Single(object): class Single(object):

View File

@ -2183,6 +2183,13 @@ class SaltSSHOptionParser(OptionParser, ConfigDirMixIn, MergeConfigMixIn,
action='store_true', action='store_true',
help=('Turn on command verbosity, display jid') help=('Turn on command verbosity, display jid')
) )
self.add_option(
'-s', '--static',
default=False,
action='store_true',
help=('Return the data from minions as a group after they '
'all return.')
)
auth_group = optparse.OptionGroup( auth_group = optparse.OptionGroup(
self, 'Authentication Options', self, 'Authentication Options',