1
0
Fork 0

added boolean handling

Dieser Commit ist enthalten in:
Sebastian Tobie 2023-11-23 18:54:34 +01:00
Ursprung 1c3d89e961
Commit 920da46658
1 geänderte Dateien mit 5 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -5,9 +5,9 @@ from typing import Any, Callable, ClassVar, Dict, NoReturn, Optional, Type, Type
import ansible.module_utils.basic as basic import ansible.module_utils.basic as basic
try: 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: except ImportError:
from plugins.module_utils.generic import AnsibleParameter, Types from plugins.module_utils.generic import AnsibleParameter, Types,systemdbool
__all__ = ( __all__ = (
@ -230,7 +230,7 @@ class SystemdUnitModule(AnsibleModule):
def header(self) -> str: def header(self) -> str:
header = "[Unit]\n" header = "[Unit]\n"
header += "\n".join( header += "".join(
self.map_param( self.map_param(
description="Description", description="Description",
documentation="Documentation", documentation="Documentation",
@ -250,9 +250,9 @@ class SystemdUnitModule(AnsibleModule):
if self.params[param] is not None: if self.params[param] is not None:
params = self.params[param] params = self.params[param]
if isinstance(params, list): 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: else:
output.append(f"{key}={self.params[param]}\n") output.append(f"{key}={systemdbool(params)}\n")
return output return output
def unitfile_gen(self): def unitfile_gen(self):