removed an missunderstanding in the docs
Dieser Commit ist enthalten in:
Ursprung
e845a06d09
Commit
1c3d89e961
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
Laden…
In neuem Issue referenzieren