saltutil.cmd module: do not shadow ret function argument

Fixes #29161.
This commit is contained in:
Justin Findlay 2015-11-25 12:30:00 -07:00
parent 7809f2a389
commit 5de0b93ac6

View file

@ -837,18 +837,18 @@ def _get_ssh_or_api_client(cfgfile, ssh=False):
def _exec(client, tgt, fun, arg, timeout, expr_form, ret, kwarg, **kwargs):
ret = {}
fcn_ret = {}
seen = 0
for ret_comp in client.cmd_iter(
tgt, fun, arg, timeout, expr_form, ret, kwarg, **kwargs):
ret.update(ret_comp)
fcn_ret.update(ret_comp)
seen += 1
# ret can be empty, so we cannot len the whole return dict
# fcn_ret can be empty, so we cannot len the whole return dict
if expr_form == 'list' and len(tgt) == seen:
# do not wait for timeout when explicit list matching
# and all results are there
break
return ret
return fcn_ret
def cmd(tgt,
@ -871,21 +871,21 @@ def cmd(tgt,
'''
cfgfile = __opts__['conf_file']
client = _get_ssh_or_api_client(cfgfile, ssh)
ret = _exec(
fcn_ret = _exec(
client, tgt, fun, arg, timeout, expr_form, ret, kwarg, **kwargs)
# if return is empty, we may have not used the right conf,
# try with the 'minion relative master configuration counter part
# if available
master_cfgfile = '{0}master'.format(cfgfile[:-6]) # remove 'minion'
if (
not ret
not fcn_ret
and cfgfile.endswith('{0}{1}'.format(os.path.sep, 'minion'))
and os.path.exists(master_cfgfile)
):
client = _get_ssh_or_api_client(master_cfgfile, ssh)
ret = _exec(
fcn_ret = _exec(
client, tgt, fun, arg, timeout, expr_form, ret, kwarg, **kwargs)
return ret
return fcn_ret
def cmd_iter(tgt,