diff --git a/plugins/modules/systemd_link.py b/plugins/modules/systemd_link.py index 4d98970..f5c6375 100644 --- a/plugins/modules/systemd_link.py +++ b/plugins/modules/systemd_link.py @@ -7,10 +7,11 @@ try: from ansible.module_utils.generic import Types from ansible.module_utils.module import SystemdUnitModule except ImportError: - from generic import SYSTEMD_NETWORK_CONFIG as SYSTEMD_PATH - from generic import Types - from module import SystemdUnitModule - + import sys + print(sys.path) + 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): """generates an systemd-networkd link""" diff --git a/plugins/modules/systemd_mount.py b/plugins/modules/systemd_mount.py index 2ac811e..0414ad1 100644 --- a/plugins/modules/systemd_mount.py +++ b/plugins/modules/systemd_mount.py @@ -1,15 +1,13 @@ #!/usr/bin/python3 import pathlib from typing import List, Optional - 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 generic import SYSTEMD_SERVICE_CONFIG as SYSTEMD_PATH - from generic import Types - from module import SystemdUnitModule + import sys + print(sys.path) SYSTEMD_PATH = pathlib.Path("/etc/systemd/system") diff --git a/plugins/modules/systemd_network.py b/plugins/modules/systemd_network.py index 2443f6a..eb6b92f 100644 --- a/plugins/modules/systemd_network.py +++ b/plugins/modules/systemd_network.py @@ -7,9 +7,8 @@ try: from ansible.module_utils.generic import Types from ansible.module_utils.module import SystemdUnitModule except ImportError: - from generic import SYSTEMD_NETWORK_CONFIG as SYSTEMD_PATH - from generic import Types - from module import SystemdUnitModule + import sys + print(sys.path) def boolconvert(b: Union[bool, str]) -> str: if b is True: diff --git a/update_doc b/update_doc index 7890907..5cd22e7 100755 --- a/update_doc +++ b/update_doc @@ -3,10 +3,11 @@ import re import pathlib import importlib import sys +import ansible.module_utils -sys.path.append("plugins/module_utils") -sys.path.append("plugins/modules") mindocstring = "DOCUMENTATION = ''''''" +sys.path.append("plugins/modules") +sys.path.append(".") moduledir = pathlib.Path("plugins/modules") regex = re.compile("DOCUMENTATION *= *r?(?P\"{3}|'{3})(---)?.*?(?P=quote)", re.MULTILINE | re.DOTALL) @@ -15,7 +16,7 @@ if __name__ == "__main__": for modfile in moduledir.iterdir(): if modfile.name in ( "__init__.py", "__pycache__"): continue - mod = importlib.import_module(modfile.stem) + mod = importlib.import_module("plugins.modules."+modfile.stem) if hasattr(mod, "Module"): module = mod.Module elif hasattr(mod, "__module_name__"):