From 920da46658e6bc1f443c434b0c109c5427d299c3 Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Thu, 23 Nov 2023 18:54:34 +0100 Subject: [PATCH] added boolean handling --- plugins/module_utils/module.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/module_utils/module.py b/plugins/module_utils/module.py index 0f20c7f..81fa69e 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 + from ansible_collections.sebastian.systemd.plugins.module_utils.generic import AnsibleParameter, Types,systemdbool except ImportError: - from plugins.module_utils.generic import AnsibleParameter, Types + from plugins.module_utils.generic import AnsibleParameter, Types,systemdbool __all__ = ( @@ -230,7 +230,7 @@ class SystemdUnitModule(AnsibleModule): def header(self) -> str: header = "[Unit]\n" - header += "\n".join( + header += "".join( self.map_param( description="Description", documentation="Documentation", @@ -250,9 +250,9 @@ class SystemdUnitModule(AnsibleModule): if self.params[param] is not None: params = self.params[param] if isinstance(params, list): - output.extend((f"{key}={p}\n" for p in params)) + output.extend((f"{key}={systemdbool(p)}\n" for p in params)) else: - output.append(f"{key}={self.params[param]}\n") + output.append(f"{key}={systemdbool(params)}\n") return output def unitfile_gen(self):