From e94dbec9f4ee294efb20e20ac2753f79c3dcf8a1 Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Sun, 23 Apr 2023 09:30:43 +0200 Subject: [PATCH] eased the redability of the installable decorator --- plugins/module_utils/module.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/module_utils/module.py b/plugins/module_utils/module.py index 352189e..aa3fe1b 100644 --- a/plugins/module_utils/module.py +++ b/plugins/module_utils/module.py @@ -323,6 +323,8 @@ _INSTALL_MAPPING = dict( def installable(_class: Type[SystemdUnitModule]): """adds the required arguments to the spec and adds the install method for the unit method""" + specs = _class.module_spec + arguments = dict( required_by=Types.list(elements=str, help="systemd units that require this mount"), wanted_by=Types.list( @@ -330,7 +332,7 @@ def installable(_class: Type[SystemdUnitModule]): help="systemd units that want the mount, but not explicitly require it. Commonly used for target if not service explicitly require it.", ), ) - _class.module_spec["argument_spec"].update(arguments) + specs["argument_spec"].update(arguments) def install(self: SystemdUnitModule) -> str: output = "[Install]\n" @@ -341,4 +343,5 @@ def installable(_class: Type[SystemdUnitModule]): return output _class.install = install + _class.module_spec = specs return _class