Un-deprecate passing kwargs outside of 'kwarg' param

This commit is contained in:
Erik Johnson 2017-08-28 19:33:06 -05:00 committed by rallytime
parent 3d3b09302d
commit 4afb179bad

View File

@ -359,29 +359,20 @@ class SyncClientMixin(object):
# packed into the top level object. The plan is to move away from
# that since the caller knows what is an arg vs a kwarg, but while
# we make the transition we will load "kwargs" using format_call if
# there are no kwargs in the low object passed in
f_call = None
if 'arg' not in low:
f_call = salt.utils.format_call(
# there are no kwargs in the low object passed in.
f_call = {} if 'arg' in low and 'kwarg' in low \
else salt.utils.format_call(
self.functions[fun],
low,
expected_extra_kws=CLIENT_INTERNAL_KEYWORDS
)
args = f_call.get('args', ())
else:
args = low['arg']
if 'kwarg' not in low:
log.critical(
'kwargs must be passed inside the low data within the '
'\'kwarg\' key. See usage of '
'salt.utils.args.parse_input() and '
'salt.minion.load_args_and_kwargs() elsewhere in the '
'codebase.'
)
kwargs = {}
else:
kwargs = low['kwarg']
args = f_call.get('args', ()) \
if 'arg' not in low \
else low['arg']
kwargs = f_call.get('kwargs', {}) \
if 'kwarg' not in low \
else low['kwarg']
# Update the event data with loaded args and kwargs
data['fun_args'] = list(args) + ([kwargs] if kwargs else [])