Merge pull request #11462 from terminalmage/non-string-args

Properly handle non-string args
This commit is contained in:
Pedro Algarvio 2014-03-23 18:47:44 +00:00
commit 4ad4f8af34
2 changed files with 13 additions and 1 deletions

View File

@ -184,7 +184,9 @@ def _salt(fun, *args, **kw):
}.get(fun, '120')) }.get(fun, '120'))
while wait_for_res: while wait_for_res:
wait_for_res -= 0.5 wait_for_res -= 0.5
cret = runner.cmd('jobs.lookup_jid', [jid, 'output=false']) cret = runner.cmd(
'jobs.lookup_jid',
[jid, {'__kwarg__': True, 'output': False}])
if target in cret: if target in cret:
ret = cret[target] ret = cret[target]
break break

View File

@ -39,6 +39,16 @@ def parse_input(args, condition=True):
_kwargs[arg_name] = yamlify_arg(arg_value) _kwargs[arg_name] = yamlify_arg(arg_value)
else: else:
_args.append(yamlify_arg(arg)) _args.append(yamlify_arg(arg))
elif isinstance(arg, dict):
# Yes, we're popping this key off and adding it back if
# condition_input is called below, but this is the only way to
# gracefully handle both CLI and API input.
if arg.pop('__kwarg__', False) is True:
_kwargs.update(arg)
else:
_args.append(arg)
else:
_args.append(arg)
if condition: if condition:
return condition_input(_args, _kwargs) return condition_input(_args, _kwargs)
return _args, _kwargs return _args, _kwargs