diff --git a/plugins/module_utils/generic.py b/plugins/module_utils/generic.py index 494d74f..6492dde 100644 --- a/plugins/module_utils/generic.py +++ b/plugins/module_utils/generic.py @@ -118,13 +118,6 @@ def modspec( ) -def format_condition(key: str, value: str) -> str: - if value[0] == "!": - value = value[1:] - key = "!" + key - return f"{key}={value}\n" - - def joindict(*items: dict) -> dict: odict = dict() for item in items: diff --git a/plugins/module_utils/module.py b/plugins/module_utils/module.py index 78da2d0..0f20c7f 100644 --- a/plugins/module_utils/module.py +++ b/plugins/module_utils/module.py @@ -5,9 +5,9 @@ from typing import Any, Callable, ClassVar, Dict, NoReturn, Optional, Type, Type import ansible.module_utils.basic as basic try: - from ansible_collections.sebastian.systemd.plugins.module_utils.generic import AnsibleParameter, Types, format_condition + from ansible_collections.sebastian.systemd.plugins.module_utils.generic import AnsibleParameter, Types except ImportError: - from plugins.module_utils.generic import AnsibleParameter, Types, format_condition + from plugins.module_utils.generic import AnsibleParameter, Types __all__ = ( @@ -250,9 +250,9 @@ class SystemdUnitModule(AnsibleModule): if self.params[param] is not None: params = self.params[param] if isinstance(params, list): - output.extend((format_condition(key, p) for p in params)) + output.extend((f"{key}={p}\n" for p in params)) else: - output.append(format_condition(key, self.params[param])) + output.append(f"{key}={self.params[param]}\n") return output def unitfile_gen(self): diff --git a/plugins/modules/link.py b/plugins/modules/link.py index 8734111..5575c6a 100644 --- a/plugins/modules/link.py +++ b/plugins/modules/link.py @@ -3,10 +3,10 @@ import pathlib from typing import List try: - from ansible_collections.sebastian.systemd.plugins.module_utils.generic import SYSTEMD_NETWORK_CONFIG, Types, format_condition, modspec + from ansible_collections.sebastian.systemd.plugins.module_utils.generic import SYSTEMD_NETWORK_CONFIG, Types, modspec from ansible_collections.sebastian.systemd.plugins.module_utils.module import SystemdUnitModule except ImportError: - from plugins.module_utils.generic import SYSTEMD_NETWORK_CONFIG, Types, format_condition, modspec + from plugins.module_utils.generic import SYSTEMD_NETWORK_CONFIG, Types, modspec from plugins.module_utils.module import SystemdUnitModule