mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-08 17:29:11 -07:00
Fix dangerous default args. (#29839)
This commit is contained in:
parent
5caa47feb9
commit
68aeaa58a8
50 changed files with 253 additions and 87 deletions
|
@ -95,8 +95,9 @@ class ModuleArgsParser:
|
|||
Args may also be munged for certain shell command parameters.
|
||||
"""
|
||||
|
||||
# FIXME: mutable default arg
|
||||
def __init__(self, task_ds=dict()):
|
||||
def __init__(self, task_ds=None):
|
||||
task_ds = {} if task_ds is None else task_ds
|
||||
|
||||
assert isinstance(task_ds, dict), "the type of 'task_ds' should be a dict, but is a %s" % type(task_ds)
|
||||
self._task_ds = task_ds
|
||||
|
||||
|
@ -129,11 +130,13 @@ class ModuleArgsParser:
|
|||
|
||||
return (action, args)
|
||||
|
||||
def _normalize_parameters(self, thing, action=None, additional_args=dict()):
|
||||
def _normalize_parameters(self, thing, action=None, additional_args=None):
|
||||
'''
|
||||
arguments can be fuzzy. Deal with all the forms.
|
||||
'''
|
||||
|
||||
additional_args = {} if additional_args is None else additional_args
|
||||
|
||||
# final args are the ones we'll eventually return, so first update
|
||||
# them with any additional args specified, which have lower priority
|
||||
# than those which may be parsed/normalized next
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue