Fixing module arg parsing splitting when action is a variable
Fixes #11122
This commit is contained in:
parent
780e428bd3
commit
165fff8a1e
1 changed files with 4 additions and 8 deletions
|
@ -23,7 +23,7 @@ from six import iteritems, string_types
|
||||||
|
|
||||||
from ansible.errors import AnsibleParserError
|
from ansible.errors import AnsibleParserError
|
||||||
from ansible.plugins import module_loader
|
from ansible.plugins import module_loader
|
||||||
from ansible.parsing.splitter import parse_kv
|
from ansible.parsing.splitter import parse_kv, split_args
|
||||||
|
|
||||||
# For filtering out modules correctly below
|
# For filtering out modules correctly below
|
||||||
RAW_PARAM_MODULES = ([
|
RAW_PARAM_MODULES = ([
|
||||||
|
@ -91,7 +91,7 @@ class ModuleArgsParser:
|
||||||
self._task_ds = task_ds
|
self._task_ds = task_ds
|
||||||
|
|
||||||
|
|
||||||
def _split_module_string(self, str):
|
def _split_module_string(self, module_string):
|
||||||
'''
|
'''
|
||||||
when module names are expressed like:
|
when module names are expressed like:
|
||||||
action: copy src=a dest=b
|
action: copy src=a dest=b
|
||||||
|
@ -99,7 +99,7 @@ class ModuleArgsParser:
|
||||||
and the rest are strings pertaining to the arguments.
|
and the rest are strings pertaining to the arguments.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
tokens = str.split()
|
tokens = split_args(module_string)
|
||||||
if len(tokens) > 1:
|
if len(tokens) > 1:
|
||||||
return (tokens[0], " ".join(tokens[1:]))
|
return (tokens[0], " ".join(tokens[1:]))
|
||||||
else:
|
else:
|
||||||
|
@ -240,17 +240,13 @@ class ModuleArgsParser:
|
||||||
args = dict()
|
args = dict()
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# We can have one of action, local_action, or module specified
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
# this is the 'extra gross' scenario detailed above, so we grab
|
# this is the 'extra gross' scenario detailed above, so we grab
|
||||||
# the args and pass them in as additional arguments, which can/will
|
# the args and pass them in as additional arguments, which can/will
|
||||||
# be overwritten via dict updates from the other arg sources below
|
# be overwritten via dict updates from the other arg sources below
|
||||||
# FIXME: add test cases for this
|
# FIXME: add test cases for this
|
||||||
additional_args = self._task_ds.get('args', dict())
|
additional_args = self._task_ds.get('args', dict())
|
||||||
|
|
||||||
|
# We can have one of action, local_action, or module specified
|
||||||
# action
|
# action
|
||||||
if 'action' in self._task_ds:
|
if 'action' in self._task_ds:
|
||||||
# an old school 'action' statement
|
# an old school 'action' statement
|
||||||
|
|
Loading…
Reference in a new issue