From 8190ee94d3fedc15897b579cfe1929c374136d6d Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Wed, 13 Mar 2024 20:17:36 +0100 Subject: [PATCH] fixed the empty options --- CHANGELOG.rst | 8 ++++++++ changelogs/.plugin-cache.yaml | 2 +- changelogs/changelog.yaml | 7 +++++++ changelogs/fragments/empty_options.yml | 3 +++ galaxy.yml | 2 +- plugins/module_utils/module.py | 4 ++-- src/ansible_module/__init__.py | 2 +- 7 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 changelogs/fragments/empty_options.yml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e2a29a6..154037b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,14 @@ Sebastian.Base Release Notes .. contents:: Topics +v0.4.2 +====== + +Minor Changes +------------- + +- removed the empty options dict + v0.4.1 ====== diff --git a/changelogs/.plugin-cache.yaml b/changelogs/.plugin-cache.yaml index dc171a5..adaf779 100644 --- a/changelogs/.plugin-cache.yaml +++ b/changelogs/.plugin-cache.yaml @@ -16,4 +16,4 @@ plugins: strategy: {} test: {} vars: {} -version: 0.4.1 +version: 0.4.2 diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index effbe3c..1bfc0a7 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -38,3 +38,10 @@ releases: - display.yml - options_fix.yml release_date: '2024-03-13' + 0.4.2: + changes: + minor_changes: + - removed the empty options dict + fragments: + - empty_options.yml + release_date: '2024-03-13' diff --git a/changelogs/fragments/empty_options.yml b/changelogs/fragments/empty_options.yml new file mode 100644 index 0000000..e4c9be5 --- /dev/null +++ b/changelogs/fragments/empty_options.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - removed the empty options dict diff --git a/galaxy.yml b/galaxy.yml index 183f67e..d9c11fa 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: sebastian name: base -version: 0.4.1 +version: 0.4.2 readme: README.md diff --git a/plugins/module_utils/module.py b/plugins/module_utils/module.py index a2a4bc1..d62372f 100644 --- a/plugins/module_utils/module.py +++ b/plugins/module_utils/module.py @@ -36,9 +36,9 @@ def docify(input: Union[dict, AnsibleParameter]) -> dict: options[name]["default"] = [] if "default" in help: options[name]["default"] = help["default"] - if "options" in help: + if "options" in help and help["options"] != {}: options[name]["options"] = docify(help["options"]) - if "choices" in help: + if "choices" in help and len(help["choices"]) > 0: options[name]["choices"] = tuple(help["choices"]) return options diff --git a/src/ansible_module/__init__.py b/src/ansible_module/__init__.py index 3d26edf..df12433 100644 --- a/src/ansible_module/__init__.py +++ b/src/ansible_module/__init__.py @@ -1 +1 @@ -__version__ = "0.4.1" +__version__ = "0.4.2"