From f18cfbdadb07bd03bcac7360bf853e1b875449cd Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Sat, 15 Apr 2023 12:20:56 +0200 Subject: [PATCH] added changes to accomodate the module documetation updater --- plugins/module_utils/module.py | 5 ++++- plugins/modules/systemd_link.py | 11 ++++++++--- plugins/modules/systemd_mount.py | 11 ++++++++--- plugins/modules/systemd_network.py | 12 ++++++++---- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/plugins/module_utils/module.py b/plugins/module_utils/module.py index ebc20de..ea3bdf1 100644 --- a/plugins/module_utils/module.py +++ b/plugins/module_utils/module.py @@ -2,7 +2,10 @@ import pathlib from typing import Any, Callable, ClassVar, Dict, Optional, TypeVar, NoReturn, overload import ansible.module_utils.basic as basic -from ansible.module_utils.generic import _sdict +try: + from ansible.module_utils.generic import _sdict +except ImportError: + from module_utils.generic import _sdict __all__ = ( "AnsibleModule", diff --git a/plugins/modules/systemd_link.py b/plugins/modules/systemd_link.py index def54f1..b405bd1 100644 --- a/plugins/modules/systemd_link.py +++ b/plugins/modules/systemd_link.py @@ -2,9 +2,14 @@ import pathlib from typing import List -from ansible.module_utils.generic import SYSTEMD_NETWORK_CONFIG as SYSTEMD_PATH -from ansible.module_utils.generic import Types -from ansible.module_utils.module import SystemdUnitModule +try: + from ansible.module_utils.generic import SYSTEMD_NETWORK_CONFIG as SYSTEMD_PATH + from ansible.module_utils.generic import Types + from ansible.module_utils.module import SystemdUnitModule +except ImportError: + from module_utils.generic import SYSTEMD_NETWORK_CONFIG as SYSTEMD_PATH + from module_utils.generic import Types + from module_utils.module import SystemdUnitModule class Module(SystemdUnitModule): diff --git a/plugins/modules/systemd_mount.py b/plugins/modules/systemd_mount.py index bf5a248..cb056ab 100644 --- a/plugins/modules/systemd_mount.py +++ b/plugins/modules/systemd_mount.py @@ -2,9 +2,14 @@ import pathlib from typing import List, Optional -from ansible.module_utils.generic import SYSTEMD_SERVICE_CONFIG as SYSTEMD_PATH -from ansible.module_utils.generic import Types -from ansible.module_utils.module import SystemdUnitModule +try: + from ansible.module_utils.generic import SYSTEMD_SERVICE_CONFIG as SYSTEMD_PATH + from ansible.module_utils.generic import Types + from ansible.module_utils.module import SystemdUnitModule +except ImportError: + from module_utils.generic import SYSTEMD_SERVICE_CONFIG as SYSTEMD_PATH + from module_utils.generic import Types + from module_utils.module import SystemdUnitModule SYSTEMD_PATH = pathlib.Path("/etc/systemd/system") diff --git a/plugins/modules/systemd_network.py b/plugins/modules/systemd_network.py index e8bb2b2..161eb78 100644 --- a/plugins/modules/systemd_network.py +++ b/plugins/modules/systemd_network.py @@ -2,10 +2,14 @@ import pathlib from typing import List, Union -from ansible.module_utils.generic import SYSTEMD_NETWORK_CONFIG as SYSTEMD_PATH -from ansible.module_utils.generic import Types -from ansible.module_utils.module import SystemdUnitModule - +try: + from ansible.module_utils.generic import SYSTEMD_NETWORK_CONFIG as SYSTEMD_PATH + from ansible.module_utils.generic import Types + from ansible.module_utils.module import SystemdUnitModule +except ImportError: + from module_utils.generic import SYSTEMD_NETWORK_CONFIG as SYSTEMD_PATH + from module_utils.generic import Types + from module_utils.module import SystemdUnitModule def boolconvert(b: Union[bool, str]) -> str: if b is True: