fix: facts deprecation warnings and result (#236)

The facts deprecation warnings or result dicts had some small nits.
This commit is contained in:
Jonas L 2023-06-27 12:20:14 +02:00 committed by GitHub
parent dfff49e31f
commit 10f47eab0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 4 deletions

View file

@ -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

View file

@ -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"]}

View file

@ -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",

View file

@ -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"]}