From 10f47eab0fec270e0a9d04e8e1f8e6790d147535 Mon Sep 17 00:00:00 2001 From: Jonas L Date: Tue, 27 Jun 2023 12:20:14 +0200 Subject: [PATCH] fix: facts deprecation warnings and result (#236) The facts deprecation warnings or result dicts had some small nits. --- changelogs/fragments/fix-facts-modules-deprecation.yml | 5 +++++ plugins/modules/hcloud_image_info.py | 7 ++++++- plugins/modules/hcloud_location_info.py | 2 +- plugins/modules/hcloud_server_type_info.py | 9 +++++++-- 4 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 changelogs/fragments/fix-facts-modules-deprecation.yml diff --git a/changelogs/fragments/fix-facts-modules-deprecation.yml b/changelogs/fragments/fix-facts-modules-deprecation.yml new file mode 100644 index 0000000..012d922 --- /dev/null +++ b/changelogs/fragments/fix-facts-modules-deprecation.yml @@ -0,0 +1,5 @@ +bugfixes: + - hcloud_image_info Fix facts modules deprecated result key + - hcloud_location_info Fix facts modules deprecation warnings + - hcloud_server_type_info Fix facts modules deprecated result dict + - hcloud_server_type_info Fix facts modules deprecation warnings diff --git a/plugins/modules/hcloud_image_info.py b/plugins/modules/hcloud_image_info.py index cea660e..fb103de 100644 --- a/plugins/modules/hcloud_image_info.py +++ b/plugins/modules/hcloud_image_info.py @@ -207,7 +207,12 @@ def main(): result = hcloud.get_result() if is_old_facts: - ansible_info = {"hcloud_imagen_facts": result["hcloud_image_info"]} + ansible_info = { + "hcloud_image_facts": result["hcloud_image_info"], + # We keep the key with a typo below to prevent a breaking changes. + # The entire module will be removed in v2.0.0 + "hcloud_imagen_facts": result["hcloud_image_info"], + } module.exit_json(ansible_facts=ansible_info) else: ansible_info = {"hcloud_image_info": result["hcloud_image_info"]} diff --git a/plugins/modules/hcloud_location_info.py b/plugins/modules/hcloud_location_info.py index bd69e55..fc091a8 100644 --- a/plugins/modules/hcloud_location_info.py +++ b/plugins/modules/hcloud_location_info.py @@ -132,7 +132,7 @@ def main(): is_old_facts = module._name == "hcloud_location_facts" if is_old_facts: module.deprecate( - "The 'hcloud_location_info' module has been renamed to 'hcloud_location_info', " + "The 'hcloud_location_facts' module has been renamed to 'hcloud_location_info', " "and the renamed one no longer returns ansible_facts", version="2.0.0", collection_name="hetzner.hcloud", diff --git a/plugins/modules/hcloud_server_type_info.py b/plugins/modules/hcloud_server_type_info.py index 4e1ba23..34703da 100644 --- a/plugins/modules/hcloud_server_type_info.py +++ b/plugins/modules/hcloud_server_type_info.py @@ -189,7 +189,7 @@ def main(): is_old_facts = module._name == "hcloud_server_type_facts" if is_old_facts: module.deprecate( - "The 'hcloud_server_type_info' module has been renamed to 'hcloud_server_type_info', " + "The 'hcloud_server_type_facts' module has been renamed to 'hcloud_server_type_info', " "and the renamed one no longer returns ansible_facts", version="2.0.0", collection_name="hetzner.hcloud", @@ -199,7 +199,12 @@ def main(): hcloud.get_server_types() result = hcloud.get_result() if is_old_facts: - ansible_info = {"hcloud_server_type_info": result["hcloud_server_type_info"]} + ansible_info = { + "hcloud_server_type_facts": result["hcloud_server_type_info"], + # We keep the key with a naming mistake below to prevent a breaking changes. + # The entire module will be removed in v2.0.0 + "hcloud_server_type_info": result["hcloud_server_type_info"], + } module.exit_json(ansible_facts=ansible_info) else: ansible_info = {"hcloud_server_type_info": result["hcloud_server_type_info"]}