Merge pull request #11733 from cachedout/11609

Support kwargs in salt-ssh
This commit is contained in:
Thomas S Hatch 2014-04-03 15:12:24 -06:00
commit 19f7baf490

View File

@ -545,7 +545,7 @@ class Single(object):
**kwargs): **kwargs):
self.opts = opts self.opts = opts
self.arg_str = arg_str self.arg_str = arg_str
self.fun, self.arg = self.__arg_comps() self.fun, self.arg, self.kwargs = self.__arg_comps()
self.id = id_ self.id = id_
args = {'host': host, args = {'host': host,
@ -573,8 +573,16 @@ class Single(object):
''' '''
comps = self.arg_str.split() comps = self.arg_str.split()
fun = comps[0] if comps else '' fun = comps[0] if comps else ''
arg = comps[1:] args = comps[1:]
return fun, arg s_args = []
kws = {}
for arg in args:
if '=' in arg:
(key, val) = arg.split('=')
kws[key] = val
else:
s_args.append(arg)
return fun, s_args, kws
def deploy(self): def deploy(self):
''' '''
@ -679,7 +687,7 @@ class Single(object):
**self.target) **self.target)
self.wfuncs = salt.loader.ssh_wrapper(opts, wrapper) self.wfuncs = salt.loader.ssh_wrapper(opts, wrapper)
wrapper.wfuncs = self.wfuncs wrapper.wfuncs = self.wfuncs
ret = json.dumps(self.wfuncs[self.fun](*self.arg)) ret = json.dumps(self.wfuncs[self.fun](*self.arg, **self.kwargs))
return ret, '', None return ret, '', None
def cmd(self): def cmd(self):