From e4f25c2ffa203a738fc736eec3212572a85e326e Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Sun, 23 Apr 2023 09:13:07 +0200 Subject: [PATCH] fixed an problem with arguments that got updated in different modules --- plugins/module_utils/module.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/module_utils/module.py b/plugins/module_utils/module.py index 676ae4f..1b84b31 100644 --- a/plugins/module_utils/module.py +++ b/plugins/module_utils/module.py @@ -1,5 +1,6 @@ import pathlib -from typing import Any, Callable, ClassVar, Dict, NoReturn, Optional, Type, TypeVar, overload +from copy import deepcopy +from typing import Any, Callable, ClassVar, Dict, NoReturn, Optional, Type, TypeVar, Union, overload import ansible.module_utils.basic as basic @@ -39,8 +40,8 @@ class AnsibleModule(object): def __init__(self): self.result = dict(changed=False) specs = dict() - specs.update(self._common_args) - modspec = self.module_spec.copy() + specs.update(deepcopy(self._common_args)) + modspec = self.module_spec if "argument_spec" in modspec and "argument_spec" in self._common_args: specs["argument_spec"].update(modspec["argument_spec"]) del modspec["argument_spec"]