From c3404200a91fe03d23eb9c756ecf6bb3b70ad585 Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Wed, 26 Apr 2023 18:58:30 +0200 Subject: [PATCH] map_param now adds newlines to the lines it generates --- plugins/module_utils/module.py | 4 ++-- plugins/modules/link.py | 2 +- plugins/modules/socket.py | 2 +- plugins/modules/system_service.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/module_utils/module.py b/plugins/module_utils/module.py index b63498b..6327f98 100644 --- a/plugins/module_utils/module.py +++ b/plugins/module_utils/module.py @@ -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(key, p) for p in params)) + output.extend(("{}={}\n".format(key, p) for p in params)) else: - output.append("{}={}".format(key, self.params[param])) + output.append("{}={}\n".format(key, self.params[param])) return output def unitfile_gen(self): diff --git a/plugins/modules/link.py b/plugins/modules/link.py index ddb6917..0ef3d5b 100644 --- a/plugins/modules/link.py +++ b/plugins/modules/link.py @@ -52,7 +52,7 @@ class Module(SystemdUnitModule): # type: ignore type="Type", kind="Kind", ) - return "[Match]\n" + "\n".join(options) + return "[Match]\n" + "".join(options) def link(self) -> str: options = [] diff --git a/plugins/modules/socket.py b/plugins/modules/socket.py index 91c9f0a..8ad9263 100644 --- a/plugins/modules/socket.py +++ b/plugins/modules/socket.py @@ -48,7 +48,7 @@ class Module(SystemdUnitModule, SystemdReloadMixin): # type: ignore def socket(self): section = "[Socket]\n" - section += "\n".join( + section += "".join( self.map_param( stream="ListenStream", datagram="ListenDatagram", diff --git a/plugins/modules/system_service.py b/plugins/modules/system_service.py index 8cc69cc..1abe4de 100644 --- a/plugins/modules/system_service.py +++ b/plugins/modules/system_service.py @@ -60,7 +60,7 @@ class Module(SystemdUnitModule, SystemdReloadMixin): def service(self): section = "[Service]\n" - section += "\n".join( + section += "".join( self.map_param( type="Type", pre="ExecStartPre",