mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #13342 from Yannig/devel_fix_bomb_shell
Devel fix bomb shell
This commit is contained in:
commit
8d9835c40b
2 changed files with 8 additions and 6 deletions
|
@ -21,7 +21,7 @@ __metaclass__ = type
|
|||
|
||||
from ansible.compat.six import iteritems, string_types
|
||||
|
||||
from ansible.errors import AnsibleParserError
|
||||
from ansible.errors import AnsibleParserError,AnsibleError
|
||||
from ansible.plugins import module_loader
|
||||
from ansible.parsing.splitter import parse_kv, split_args
|
||||
from ansible.template import Templar
|
||||
|
@ -155,6 +155,13 @@ class ModuleArgsParser:
|
|||
tmp_args = parse_kv(tmp_args)
|
||||
args.update(tmp_args)
|
||||
|
||||
# only internal variables can start with an underscore, so
|
||||
# we don't allow users to set them directy in arguments
|
||||
if action not in ('command', 'shell', 'script', 'raw'):
|
||||
for arg in args:
|
||||
if arg.startswith('_ansible_'):
|
||||
raise AnsibleError("invalid parameter specified for action '%s': '%s'" % (action, arg))
|
||||
|
||||
# finally, update the args we're going to return with the ones
|
||||
# which were normalized above
|
||||
if args:
|
||||
|
|
|
@ -83,11 +83,6 @@ def parse_kv(args, check_raw=False):
|
|||
k = x[:pos]
|
||||
v = x[pos + 1:]
|
||||
|
||||
# only internal variables can start with an underscore, so
|
||||
# we don't allow users to set them directy in arguments
|
||||
if k.startswith('_'):
|
||||
raise AnsibleError("invalid parameter specified: '%s'" % k)
|
||||
|
||||
# FIXME: make the retrieval of this list of shell/command
|
||||
# options a function, so the list is centralized
|
||||
if check_raw and k not in ('creates', 'removes', 'chdir', 'executable', 'warn'):
|
||||
|
|
Loading…
Reference in a new issue