Support cmd param in Tasks by assigning it to _raw_params

Fixes #12856
This commit is contained in:
James Cammarata 2015-10-21 15:43:01 -04:00
parent 5a0e63af1e
commit 2b3c5aa41e

View file

@ -171,6 +171,15 @@ class Task(Base, Conditional, Taggable, Become):
args_parser = ModuleArgsParser(task_ds=ds)
(action, args, delegate_to) = args_parser.parse()
# the command/shell/script modules used to support the `cmd` arg,
# which corresponds to what we now call _raw_params, so move that
# value over to _raw_params (assuming it is empty)
if action in ('command', 'shell', 'script'):
if 'cmd' in args:
if args.get('_raw_params', '') != '':
raise AnsibleError("The 'cmd' argument cannot be used when other raw parameters are specified. Please put everything in one or the other place.", obj=ds)
args['_raw_params'] = args.pop('cmd')
new_ds['action'] = action
new_ds['args'] = args
new_ds['delegate_to'] = delegate_to