From 3198a0d064129b965324de0cb30c01bcc2152a5b Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Sun, 11 Feb 2024 14:35:00 +0100 Subject: [PATCH] fixed the import --- CHANGELOG.rst | 10 ++++++++- changelogs/changelog.yaml | 37 +++++++++++++++++-------------- galaxy.yml | 11 ++++----- plugins/modules/link.py | 8 +++++-- plugins/modules/mount.py | 8 +++++-- plugins/modules/netdev.py | 8 +++++-- plugins/modules/network.py | 8 +++++-- plugins/modules/socket.py | 8 +++++-- plugins/modules/system_service.py | 8 +++++-- plugins/modules/target.py | 8 +++++-- plugins/modules/unit.py.example | 16 +++++++++---- requirements.txt | 1 - 12 files changed, 89 insertions(+), 42 deletions(-) delete mode 100644 requirements.txt diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3c264c2..92c5617 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,10 +1,18 @@ ===================================== -sebastian.systemd 0.3.5 Release Notes +sebastian.systemd 0.3.6 Release Notes ===================================== .. contents:: Topics +v0.3.6 +====== + +Changelog +--------- + +fixed the import of the module utils + v0.3.5 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index e579751..63ed548 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -3,51 +3,54 @@ releases: 0.1.0: changes: major_changes: - - added systemd_link module - - added systemd_mount module - - added systemd_network module + - added systemd_link module + - added systemd_mount module + - added systemd_network module release_summary: Erstes Release - release_date: '2023-04-15' + release_date: "2023-04-15" 0.1.1: changes: minor_changes: - - "update_doc hinzugef\xFCgt. um Dokumentation automatisch zu aktualisieren" + - "update_doc hinzugef\xFCgt. um Dokumentation automatisch zu aktualisieren" release_summary: kleines feature update - release_date: '2023-04-15' + release_date: "2023-04-15" 0.1.2: changes: - release_summary: "Pfad der aufl\xF6sung f\xFCr Tests und autodoc ge\xE4ndert, - weil Mitogen sonst blockiert" - release_date: '2023-04-15' + release_summary: "Pfad der aufl\xF6sung f\xFCr Tests und autodoc ge\xE4ndert, weil Mitogen sonst blockiert" + release_date: "2023-04-15" 0.1.3: changes: release_summary: renamed all modules to names without systemd_ prefix - release_date: '2023-04-20' + release_date: "2023-04-20" 0.2.0: changes: release_summary: added an rudimentary system_service module - release_date: '2023-04-21' + release_date: "2023-04-21" 0.3.0: changes: release_summary: added socket module and some small fixes - release_date: '2023-04-23' + release_date: "2023-04-23" 0.3.1: changes: release_summary: fixed runtime.yml - release_date: '2023-04-23' + release_date: "2023-04-23" 0.3.2: changes: release_summary: added virtualization and negative matches to link and network - release_date: '2023-07-15' + release_date: "2023-07-15" 0.3.3: changes: release_summary: added netdev module - release_date: '2023-07-16' + release_date: "2023-07-16" 0.3.4: changes: release_summary: moved the module_utils to an indipendent repository - release_date: '2023-11-26' + release_date: "2023-11-26" 0.3.5: changes: release_summary: added some ignores and changed my name - release_date: '2023-12-30' + release_date: "2023-12-30" + 0.3.6: + release_date: "2024-02-11" + changes: + release_summary: fixed the import of the module utils diff --git a/galaxy.yml b/galaxy.yml index 09abe4f..849920a 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,25 +1,26 @@ --- namespace: sebastian name: systemd -version: 0.3.5 +version: 0.3.6 readme: README.md authors: - Sebastian Tobie description: An simple for generating systemd units with ansible -license_file: 'LICENSE' +license_file: "LICENSE" tags: - systemd - linux -dependencies: {} +dependencies: + sebastian.base: ">=0.2.0" repository: https://gitea.sebastian-tobie.de/ansible/ansible-systemd.git # documentation: http://docs.example.com homepage: https://gitea.sebastian-tobie.de/ansible/ansible-systemd issues: https://gitea.sebastian-tobie.de/ansible/ansible-systemd/issues build_ignore: - - '*.gz' - - '.*' + - "*.gz" + - ".*" - Makefile - pyproject.toml - upload.sh diff --git a/plugins/modules/link.py b/plugins/modules/link.py index e681353..d776441 100644 --- a/plugins/modules/link.py +++ b/plugins/modules/link.py @@ -2,8 +2,12 @@ import pathlib from typing import List -from ansible_module.generic import SYSTEMD_NETWORK_CONFIG, Types, modspec -from ansible_module.module import SystemdUnitModule +try: + from ansible_module.generic import SYSTEMD_NETWORK_CONFIG, Types, modspec + from ansible_module.module import SystemdUnitModule +except ImportError: + from ansible.module_utils.sebastian.base.module_utils.generic import SYSTEMD_NETWORK_CONFIG, Types, modspec + from ansible.module_utils.sebastian.base.module_utils.module import SystemdUnitModule class Module(SystemdUnitModule): # type: ignore diff --git a/plugins/modules/mount.py b/plugins/modules/mount.py index 1c1c8fa..93b62ac 100644 --- a/plugins/modules/mount.py +++ b/plugins/modules/mount.py @@ -2,8 +2,12 @@ import pathlib from typing import List, Optional -from ansible_module.generic import SYSTEMD_SERVICE_CONFIG, Types, modspec -from ansible_module.module import SystemdReloadMixin, SystemdUnitModule, installable +try: + from ansible_module.generic import SYSTEMD_SERVICE_CONFIG, Types, modspec + from ansible_module.module import SystemdReloadMixin, SystemdUnitModule, installable +except ImportError: + from ansible.module_utils.sebastian.base.module_utils.generic import SYSTEMD_SERVICE_CONFIG, Types, modspec + from ansible.module_utils.sebastian.base.module_utils.module import SystemdReloadMixin, SystemdUnitModule, installable SYSTEMD_SERVICE_CONFIG = pathlib.Path("/etc/systemd/system") diff --git a/plugins/modules/netdev.py b/plugins/modules/netdev.py index 19a3270..2db9027 100644 --- a/plugins/modules/netdev.py +++ b/plugins/modules/netdev.py @@ -2,8 +2,12 @@ import pathlib from typing import List, Optional -from ansible_module.generic import SYSTEMD_NETWORK_CONFIG, Types, joindict, modspec, systemdbool -from ansible_module.module import SystemdUnitModule +try: + from ansible_module.generic import SYSTEMD_NETWORK_CONFIG, Types, joindict, modspec, systemdbool + from ansible_module.module import SystemdUnitModule +except ImportError: + from ansible.module_utils.sebastian.base.module_utils.generic import SYSTEMD_NETWORK_CONFIG, Types, joindict, modspec, systemdbool + from ansible.module_utils.sebastian.base.module_utils.module import SystemdUnitModule kinds = ( "bond", diff --git a/plugins/modules/network.py b/plugins/modules/network.py index 45974c1..0e0c67c 100644 --- a/plugins/modules/network.py +++ b/plugins/modules/network.py @@ -2,8 +2,12 @@ import pathlib from typing import List, Union -from ansible_module.generic import SYSTEMD_NETWORK_CONFIG, Types, modspec, systemdbool -from ansible_module.module import SystemdUnitModule +try: + from ansible_module.generic import SYSTEMD_NETWORK_CONFIG, Types, modspec, systemdbool + from ansible_module.module import SystemdUnitModule +except ImportError: + from ansible.module_utils.sebastian.base.module_utils.generic import SYSTEMD_NETWORK_CONFIG, Types, modspec, systemdbool + from ansible.module_utils.sebastian.base.module_utils.module import SystemdUnitModule class Module(SystemdUnitModule): # type: ignore diff --git a/plugins/modules/socket.py b/plugins/modules/socket.py index 3018249..61ea93c 100644 --- a/plugins/modules/socket.py +++ b/plugins/modules/socket.py @@ -2,8 +2,12 @@ import pathlib from typing import List, Union -from ansible_module.generic import SYSTEMD_SERVICE_CONFIG, Types, modspec -from ansible_module.module import SystemdReloadMixin, SystemdUnitModule, installable +try: + from ansible_module.generic import SYSTEMD_SERVICE_CONFIG, Types, modspec + from ansible_module.module import SystemdReloadMixin, SystemdUnitModule, installable +except ImportError: + from ansible.module_utils.sebastian.base.module_utils.generic import SYSTEMD_SERVICE_CONFIG, Types, modspec + from ansible.module_utils.sebastian.base.module_utils.module import SystemdReloadMixin, SystemdUnitModule, installable @installable diff --git a/plugins/modules/system_service.py b/plugins/modules/system_service.py index 226d69e..97a8053 100644 --- a/plugins/modules/system_service.py +++ b/plugins/modules/system_service.py @@ -2,8 +2,12 @@ import pathlib from typing import List, Union -from ansible_module.generic import SYSTEMD_SERVICE_CONFIG, Types -from ansible_module.module import SystemdReloadMixin, SystemdUnitModule, installable +try: + from ansible_module.generic import SYSTEMD_SERVICE_CONFIG, Types + from ansible_module.module import SystemdReloadMixin, SystemdUnitModule, installable +except ImportError: + from ansible.module_utils.sebastian.base.module_utils.generic import SYSTEMD_SERVICE_CONFIG, Types + from ansible.module_utils.sebastian.base.module_utils.module import SystemdReloadMixin, SystemdUnitModule, installable @installable diff --git a/plugins/modules/target.py b/plugins/modules/target.py index 5ee3086..98a0c41 100644 --- a/plugins/modules/target.py +++ b/plugins/modules/target.py @@ -2,8 +2,12 @@ import pathlib from typing import List, Union -from ansible_module.generic import SYSTEMD_SERVICE_CONFIG, Types, systemdbool -from ansible_module.module import SystemdReloadMixin, SystemdUnitModule, installable +try: + from ansible_module.generic import SYSTEMD_SERVICE_CONFIG, Types, systemdbool + from ansible_module.module import SystemdReloadMixin, SystemdUnitModule, installable +except ImportError: + from ansible.module_utils.sebastian.base.module_utils.generic import SYSTEMD_SERVICE_CONFIG, Types, systemdbool + from ansible.module_utils.sebastian.base.module_utils.module import SystemdReloadMixin, SystemdUnitModule, installable __module_name__ = "TargetModule" diff --git a/plugins/modules/unit.py.example b/plugins/modules/unit.py.example index ed9d4c6..592e30d 100644 --- a/plugins/modules/unit.py.example +++ b/plugins/modules/unit.py.example @@ -2,16 +2,24 @@ import pathlib from typing import List, Union -from ansible_module.generic import SYSTEMD_SERVICE_CONFIG, Types, modpec -from ansible_module.module import SystemdReloadMixin, SystemdUnitModule, installable +try: + from ansible_module.generic import SYSTEMD_SERVICE_CONFIG, Types, modpec + from ansible_module.module import SystemdReloadMixin, SystemdUnitModule, installable +except ImportError: + from ansible.module_utils.sebastian.base.module_utils.generic import SYSTEMD_SERVICE_CONFIG, Types, modpec + from ansible.module_utils.sebastian.base.module_utils.module import SystemdReloadMixin, SystemdUnitModule, installable @installable -class Module(SystemdUnitModule, SystemdReloadMixin): # type: ignore +class Module(SystemdUnitModule, SystemdReloadMixin): # type: ignore """Creates units""" name = "unit" - module_spec = modspec(argument_spec=dict(name=Types.str(required=True, help="Name of the unit"),)) + module_spec = modspec( + argument_spec=dict( + name=Types.str(required=True, help="Name of the unit"), + ) + ) def prepare(self): self.unitfile = (SYSTEMD_SERVICE_CONFIG / self.get("name")).with_suffix(".") diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 018a005..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -ansible-module>=0.1.3