1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

During initial argument evaluation, cast args to string. (#17595)

Later in the stack, further code will check and inform the user that var names must start with a letter
or underscore, so this fix only allows us to get to that previously existing policy.

Fixes #16008
This commit is contained in:
jctanner 2016-09-15 16:41:11 -04:00 committed by GitHub
parent 2c54a8471f
commit b93de25204

View file

@ -22,6 +22,7 @@ __metaclass__ = type
from ansible.compat.six import iteritems, string_types from ansible.compat.six import iteritems, string_types
from ansible.errors import AnsibleParserError,AnsibleError from ansible.errors import AnsibleParserError,AnsibleError
from ansible.module_utils._text import to_text
from ansible.plugins import module_loader from ansible.plugins import module_loader
from ansible.parsing.splitter import parse_kv, split_args from ansible.parsing.splitter import parse_kv, split_args
from ansible.template import Templar from ansible.template import Templar
@ -165,6 +166,7 @@ class ModuleArgsParser:
# we don't allow users to set them directy in arguments # we don't allow users to set them directy in arguments
if args and action not in ('command', 'win_command', 'shell', 'win_shell', 'script', 'raw'): if args and action not in ('command', 'win_command', 'shell', 'win_shell', 'script', 'raw'):
for arg in args: for arg in args:
arg = to_text(arg)
if arg.startswith('_ansible_'): if arg.startswith('_ansible_'):
raise AnsibleError("invalid parameter specified for action '%s': '%s'" % (action, arg)) raise AnsibleError("invalid parameter specified for action '%s': '%s'" % (action, arg))