From 49c3ef1ae798b51fafecf5f7af4e940f1e7ef255 Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Fri, 21 Apr 2023 20:49:21 +0200 Subject: [PATCH] allow_isolate is now used --- plugins/modules/target.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/modules/target.py b/plugins/modules/target.py index 7402dde..5cfa972 100644 --- a/plugins/modules/target.py +++ b/plugins/modules/target.py @@ -3,10 +3,10 @@ import pathlib from typing import List, Union try: - from ansible_collections.sebastian.systemd.plugins.module_utils.generic import SYSTEMD_SERVICE_CONFIG, Types + from ansible_collections.sebastian.systemd.plugins.module_utils.generic import SYSTEMD_SERVICE_CONFIG, Types, systemdbool from ansible_collections.sebastian.systemd.plugins.module_utils.module import SystemdUnitModule, installable except ImportError: - from plugins.module_utils.generic import SYSTEMD_SERVICE_CONFIG, Types + from plugins.module_utils.generic import SYSTEMD_SERVICE_CONFIG, Types, systemdbool from plugins.module_utils.module import SystemdUnitModule, installable @@ -17,12 +17,18 @@ class Module(SystemdUnitModule): name = "target" module_spec = dict( argument_spec=dict( - description=Types.str(required=True), + description=Types.str(), name=Types.str(required=True), allow_isolate=Types.bool(default=False), ), ) + def header(self) -> str: + section = super().header() + section += "AllowIsolate={}".format(systemdbool(self.get("allow_isolate", False))) + return section + + def unit(self) -> str: if self.__unit is None: self.__unit = "\n".join(