From 5190535323bc03838bbe80680801ea35777a0c0b Mon Sep 17 00:00:00 2001 From: Jonas L Date: Wed, 5 Jul 2023 09:32:03 +0200 Subject: [PATCH] feat: remove deprecated facts modules (#251) Fixes #8 --- .../remove-deprecated-facts-modules.yml | 9 +++++ meta/runtime.yml | 34 ------------------- plugins/modules/hcloud_certificate_info.py | 2 +- plugins/modules/hcloud_datacenter_facts.py | 1 - plugins/modules/hcloud_datacenter_info.py | 22 ++---------- plugins/modules/hcloud_floating_ip_facts.py | 1 - plugins/modules/hcloud_floating_ip_info.py | 21 ++---------- plugins/modules/hcloud_image_facts.py | 1 - plugins/modules/hcloud_image_info.py | 26 ++------------ plugins/modules/hcloud_load_balancer_info.py | 2 +- .../modules/hcloud_load_balancer_type_info.py | 3 +- plugins/modules/hcloud_location_facts.py | 1 - plugins/modules/hcloud_location_info.py | 22 +++--------- plugins/modules/hcloud_network_info.py | 3 +- plugins/modules/hcloud_primary_ip_info.py | 1 - plugins/modules/hcloud_server_facts.py | 1 - plugins/modules/hcloud_server_info.py | 21 ++---------- plugins/modules/hcloud_server_type_facts.py | 1 - plugins/modules/hcloud_server_type_info.py | 27 +++------------ plugins/modules/hcloud_ssh_key_facts.py | 1 - plugins/modules/hcloud_ssh_key_info.py | 21 ++---------- plugins/modules/hcloud_volume_facts.py | 1 - plugins/modules/hcloud_volume_info.py | 19 ++--------- 23 files changed, 41 insertions(+), 200 deletions(-) create mode 100644 changelogs/fragments/remove-deprecated-facts-modules.yml delete mode 120000 plugins/modules/hcloud_datacenter_facts.py delete mode 120000 plugins/modules/hcloud_floating_ip_facts.py delete mode 120000 plugins/modules/hcloud_image_facts.py delete mode 120000 plugins/modules/hcloud_location_facts.py delete mode 120000 plugins/modules/hcloud_server_facts.py delete mode 120000 plugins/modules/hcloud_server_type_facts.py delete mode 120000 plugins/modules/hcloud_ssh_key_facts.py delete mode 120000 plugins/modules/hcloud_volume_facts.py diff --git a/changelogs/fragments/remove-deprecated-facts-modules.yml b/changelogs/fragments/remove-deprecated-facts-modules.yml new file mode 100644 index 0000000..0230568 --- /dev/null +++ b/changelogs/fragments/remove-deprecated-facts-modules.yml @@ -0,0 +1,9 @@ +removed_features: + - hcloud_datacenter_facts Removed deprecated facts module + - hcloud_floating_ip_facts Removed deprecated facts module + - hcloud_image_facts Removed deprecated facts module + - hcloud_location_facts Removed deprecated facts module + - hcloud_server_facts Removed deprecated facts module + - hcloud_server_type_facts Removed deprecated facts module + - hcloud_ssh_key_facts Removed deprecated facts module + - hcloud_volume_facts Removed deprecated facts module diff --git a/meta/runtime.yml b/meta/runtime.yml index 0b32009..237954c 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,35 +1 @@ requires_ansible: ">=2.13.0" -plugin_routing: - modules: - hcloud_location_facts: - deprecation: - removal_version: 2.0.0 - warning_text: see plugin documentation for details - hcloud_server_type_facts: - deprecation: - removal_version: 2.0.0 - warning_text: see plugin documentation for details - hcloud_image_facts: - deprecation: - removal_version: 2.0.0 - warning_text: see plugin documentation for details - hcloud_volume_facts: - deprecation: - removal_version: 2.0.0 - warning_text: see plugin documentation for details - hcloud_floating_ip_facts: - deprecation: - removal_version: 2.0.0 - warning_text: see plugin documentation for details - hcloud_ssh_key_facts: - deprecation: - removal_version: 2.0.0 - warning_text: see plugin documentation for details - hcloud_datacenter_facts: - deprecation: - removal_version: 2.0.0 - warning_text: see plugin documentation for details - hcloud_server_facts: - deprecation: - removal_version: 2.0.0 - warning_text: see plugin documentation for details diff --git a/plugins/modules/hcloud_certificate_info.py b/plugins/modules/hcloud_certificate_info.py index 84c2414..19a138e 100644 --- a/plugins/modules/hcloud_certificate_info.py +++ b/plugins/modules/hcloud_certificate_info.py @@ -142,8 +142,8 @@ class AnsibleHcloudCertificateInfo(Hcloud): def main(): module = AnsibleHcloudCertificateInfo.define_module() - hcloud = AnsibleHcloudCertificateInfo(module) + hcloud.get_certificates() result = hcloud.get_result() diff --git a/plugins/modules/hcloud_datacenter_facts.py b/plugins/modules/hcloud_datacenter_facts.py deleted file mode 120000 index 44473ed..0000000 --- a/plugins/modules/hcloud_datacenter_facts.py +++ /dev/null @@ -1 +0,0 @@ -hcloud_datacenter_info.py \ No newline at end of file diff --git a/plugins/modules/hcloud_datacenter_info.py b/plugins/modules/hcloud_datacenter_info.py index 7ccba0f..2f6023b 100644 --- a/plugins/modules/hcloud_datacenter_info.py +++ b/plugins/modules/hcloud_datacenter_info.py @@ -12,8 +12,6 @@ short_description: Gather info about the Hetzner Cloud datacenters. description: - Gather info about your Hetzner Cloud datacenters. - - This module was called C(hcloud_datacenter_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_datacenter_facts). - Note that the M(hetzner.hcloud.hcloud_datacenter_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_datacenter_info)! author: - Lukas Kaemmerling (@LKaemmerling) @@ -45,8 +43,6 @@ RETURN = """ hcloud_datacenter_info: description: - The datacenter info as list - - This module was called C(hcloud_datacenter_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_datacenter_facts). - Note that the M(hetzner.hcloud.hcloud_datacenter_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_datacenter_info)! returned: always type: complex contains: @@ -129,25 +125,13 @@ class AnsibleHcloudDatacenterInfo(Hcloud): def main(): module = AnsibleHcloudDatacenterInfo.define_module() - - is_old_facts = module._name == "hcloud_datacenter_facts" - if is_old_facts: - module.deprecate( - "The 'hcloud_datacenter_facts' module has been renamed to 'hcloud_datacenter_info', " - "and the renamed one no longer returns ansible_facts", - version="2.0.0", - collection_name="hetzner.hcloud", - ) hcloud = AnsibleHcloudDatacenterInfo(module) hcloud.get_datacenters() result = hcloud.get_result() - if is_old_facts: - ansible_info = {"hcloud_datacenter_facts": result["hcloud_datacenter_info"]} - module.exit_json(ansible_facts=ansible_info) - else: - ansible_info = {"hcloud_datacenter_info": result["hcloud_datacenter_info"]} - module.exit_json(**ansible_info) + + ansible_info = {"hcloud_datacenter_info": result["hcloud_datacenter_info"]} + module.exit_json(**ansible_info) if __name__ == "__main__": diff --git a/plugins/modules/hcloud_floating_ip_facts.py b/plugins/modules/hcloud_floating_ip_facts.py deleted file mode 120000 index 76db56c..0000000 --- a/plugins/modules/hcloud_floating_ip_facts.py +++ /dev/null @@ -1 +0,0 @@ -hcloud_floating_ip_info.py \ No newline at end of file diff --git a/plugins/modules/hcloud_floating_ip_info.py b/plugins/modules/hcloud_floating_ip_info.py index c0ec50b..0427411 100644 --- a/plugins/modules/hcloud_floating_ip_info.py +++ b/plugins/modules/hcloud_floating_ip_info.py @@ -12,8 +12,6 @@ short_description: Gather infos about the Hetzner Cloud Floating IPs. description: - Gather facts about your Hetzner Cloud Floating IPs. - - This module was called C(hcloud_floating_ip_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_floating_ip_facts). - Note that the M(hetzner.hcloud.hcloud_floating_ip_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_floating_ip_info)! author: - Lukas Kaemmerling (@LKaemmerling) @@ -156,26 +154,13 @@ class AnsibleHcloudFloatingIPInfo(Hcloud): def main(): module = AnsibleHcloudFloatingIPInfo.define_module() - - is_old_facts = module._name == "hcloud_floating_ip_facts" - if is_old_facts: - module.deprecate( - "The 'hcloud_floating_ip_facts' module has been renamed to 'hcloud_floating_ip_info', " - "and the renamed one no longer returns ansible_facts", - version="2.0.0", - collection_name="hetzner.hcloud", - ) - hcloud = AnsibleHcloudFloatingIPInfo(module) hcloud.get_floating_ips() result = hcloud.get_result() - if is_old_facts: - ansible_info = {"hcloud_floating_ip_facts": result["hcloud_floating_ip_info"]} - module.exit_json(ansible_facts=ansible_info) - else: - ansible_info = {"hcloud_floating_ip_info": result["hcloud_floating_ip_info"]} - module.exit_json(**ansible_info) + + ansible_info = {"hcloud_floating_ip_info": result["hcloud_floating_ip_info"]} + module.exit_json(**ansible_info) if __name__ == "__main__": diff --git a/plugins/modules/hcloud_image_facts.py b/plugins/modules/hcloud_image_facts.py deleted file mode 120000 index c673044..0000000 --- a/plugins/modules/hcloud_image_facts.py +++ /dev/null @@ -1 +0,0 @@ -hcloud_image_info.py \ No newline at end of file diff --git a/plugins/modules/hcloud_image_info.py b/plugins/modules/hcloud_image_info.py index 48c1311..d9c85ac 100644 --- a/plugins/modules/hcloud_image_info.py +++ b/plugins/modules/hcloud_image_info.py @@ -13,8 +13,6 @@ short_description: Gather infos about your Hetzner Cloud images. description: - Gather infos about your Hetzner Cloud images. - - This module was called C(hcloud_location_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_location_facts). - Note that the M(hetzner.hcloud.hcloud_image_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_image_info)! author: - Lukas Kaemmerling (@LKaemmerling) @@ -192,31 +190,13 @@ class AnsibleHcloudImageInfo(Hcloud): def main(): module = AnsibleHcloudImageInfo.define_module() - - is_old_facts = module._name == "hcloud_image_facts" - if is_old_facts: - module.deprecate( - "The 'hcloud_image_facts' module has been renamed to 'hcloud_image_info', " - "and the renamed one no longer returns ansible_facts", - version="2.0.0", - collection_name="hetzner.hcloud", - ) - hcloud = AnsibleHcloudImageInfo(module) + hcloud.get_images() result = hcloud.get_result() - if is_old_facts: - 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"]} - module.exit_json(**ansible_info) + ansible_info = {"hcloud_image_info": result["hcloud_image_info"]} + module.exit_json(**ansible_info) if __name__ == "__main__": diff --git a/plugins/modules/hcloud_load_balancer_info.py b/plugins/modules/hcloud_load_balancer_info.py index a3c5961..e7eb3c6 100644 --- a/plugins/modules/hcloud_load_balancer_info.py +++ b/plugins/modules/hcloud_load_balancer_info.py @@ -378,8 +378,8 @@ class AnsibleHcloudLoadBalancerInfo(Hcloud): def main(): module = AnsibleHcloudLoadBalancerInfo.define_module() - hcloud = AnsibleHcloudLoadBalancerInfo(module) + hcloud.get_load_balancers() result = hcloud.get_result() diff --git a/plugins/modules/hcloud_load_balancer_type_info.py b/plugins/modules/hcloud_load_balancer_type_info.py index 390e34f..e9a7379 100644 --- a/plugins/modules/hcloud_load_balancer_type_info.py +++ b/plugins/modules/hcloud_load_balancer_type_info.py @@ -142,10 +142,11 @@ class AnsibleHcloudLoadBalancerTypeInfo(Hcloud): def main(): module = AnsibleHcloudLoadBalancerTypeInfo.define_module() - hcloud = AnsibleHcloudLoadBalancerTypeInfo(module) + hcloud.get_load_balancer_types() result = hcloud.get_result() + ansible_info = {"hcloud_load_balancer_type_info": result["hcloud_load_balancer_type_info"]} module.exit_json(**ansible_info) diff --git a/plugins/modules/hcloud_location_facts.py b/plugins/modules/hcloud_location_facts.py deleted file mode 120000 index adb06ec..0000000 --- a/plugins/modules/hcloud_location_facts.py +++ /dev/null @@ -1 +0,0 @@ -hcloud_location_info.py \ No newline at end of file diff --git a/plugins/modules/hcloud_location_info.py b/plugins/modules/hcloud_location_info.py index d230f7f..03eb20b 100644 --- a/plugins/modules/hcloud_location_info.py +++ b/plugins/modules/hcloud_location_info.py @@ -13,8 +13,6 @@ short_description: Gather infos about your Hetzner Cloud locations. description: - Gather infos about your Hetzner Cloud locations. - - This module was called C(hcloud_location_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_location_facts). - Note that the M(hetzner.hcloud.hcloud_location_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_location_info)! author: - Lukas Kaemmerling (@LKaemmerling) @@ -128,25 +126,13 @@ class AnsibleHcloudLocationInfo(Hcloud): def main(): module = AnsibleHcloudLocationInfo.define_module() - - is_old_facts = module._name == "hcloud_location_facts" - if is_old_facts: - module.deprecate( - "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", - ) - hcloud = AnsibleHcloudLocationInfo(module) + hcloud.get_locations() result = hcloud.get_result() - if is_old_facts: - ansible_info = {"hcloud_location_facts": result["hcloud_location_info"]} - module.exit_json(ansible_facts=ansible_info) - else: - ansible_info = {"hcloud_location_info": result["hcloud_location_info"]} - module.exit_json(**ansible_info) + + ansible_info = {"hcloud_location_info": result["hcloud_location_info"]} + module.exit_json(**ansible_info) if __name__ == "__main__": diff --git a/plugins/modules/hcloud_network_info.py b/plugins/modules/hcloud_network_info.py index 5cdfcdc..17d4ff8 100644 --- a/plugins/modules/hcloud_network_info.py +++ b/plugins/modules/hcloud_network_info.py @@ -277,10 +277,11 @@ class AnsibleHcloudNetworkInfo(Hcloud): def main(): module = AnsibleHcloudNetworkInfo.define_module() - hcloud = AnsibleHcloudNetworkInfo(module) + hcloud.get_networks() result = hcloud.get_result() + info = {"hcloud_network_info": result["hcloud_network_info"]} module.exit_json(**info) diff --git a/plugins/modules/hcloud_primary_ip_info.py b/plugins/modules/hcloud_primary_ip_info.py index 6130f39..fa8b6cf 100644 --- a/plugins/modules/hcloud_primary_ip_info.py +++ b/plugins/modules/hcloud_primary_ip_info.py @@ -185,7 +185,6 @@ class AnsibleHcloudPrimaryIPInfo(Hcloud): def main(): module = AnsibleHcloudPrimaryIPInfo.define_module() - hcloud = AnsibleHcloudPrimaryIPInfo(module) hcloud.get_primary_ips() diff --git a/plugins/modules/hcloud_server_facts.py b/plugins/modules/hcloud_server_facts.py deleted file mode 120000 index cc0efff..0000000 --- a/plugins/modules/hcloud_server_facts.py +++ /dev/null @@ -1 +0,0 @@ -hcloud_server_info.py \ No newline at end of file diff --git a/plugins/modules/hcloud_server_info.py b/plugins/modules/hcloud_server_info.py index ee3d3fe..3521150 100644 --- a/plugins/modules/hcloud_server_info.py +++ b/plugins/modules/hcloud_server_info.py @@ -13,8 +13,6 @@ short_description: Gather infos about your Hetzner Cloud servers. description: - Gather infos about your Hetzner Cloud servers. - - This module was called C(hcloud_server_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_server_facts). - Note that the M(hetzner.hcloud.hcloud_server_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_server_info)! author: - Lukas Kaemmerling (@LKaemmerling) @@ -215,26 +213,13 @@ class AnsibleHcloudServerInfo(Hcloud): def main(): module = AnsibleHcloudServerInfo.define_module() - - is_old_facts = module._name == "hcloud_server_facts" - if is_old_facts: - module.deprecate( - "The 'hcloud_server_facts' module has been renamed to 'hcloud_server_info', " - "and the renamed one no longer returns ansible_facts", - version="2.0.0", - collection_name="hetzner.hcloud", - ) - hcloud = AnsibleHcloudServerInfo(module) + hcloud.get_servers() result = hcloud.get_result() - if is_old_facts: - ansible_info = {"hcloud_server_facts": result["hcloud_server_info"]} - module.exit_json(ansible_facts=ansible_info) - else: - ansible_info = {"hcloud_server_info": result["hcloud_server_info"]} - module.exit_json(**ansible_info) + ansible_info = {"hcloud_server_info": result["hcloud_server_info"]} + module.exit_json(**ansible_info) if __name__ == "__main__": diff --git a/plugins/modules/hcloud_server_type_facts.py b/plugins/modules/hcloud_server_type_facts.py deleted file mode 120000 index 5fe872d..0000000 --- a/plugins/modules/hcloud_server_type_facts.py +++ /dev/null @@ -1 +0,0 @@ -hcloud_server_type_info.py \ No newline at end of file diff --git a/plugins/modules/hcloud_server_type_info.py b/plugins/modules/hcloud_server_type_info.py index 866eb7f..7fb11c3 100644 --- a/plugins/modules/hcloud_server_type_info.py +++ b/plugins/modules/hcloud_server_type_info.py @@ -13,8 +13,6 @@ short_description: Gather infos about the Hetzner Cloud server types. description: - Gather infos about your Hetzner Cloud server types. - - This module was called C(hcloud_server_type_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_server_type_facts). - Note that the M(hetzner.hcloud.hcloud_server_type_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_server_type_info)! author: - Lukas Kaemmerling (@LKaemmerling) @@ -185,30 +183,13 @@ class AnsibleHcloudServerTypeInfo(Hcloud): def main(): module = AnsibleHcloudServerTypeInfo.define_module() - - is_old_facts = module._name == "hcloud_server_type_facts" - if is_old_facts: - module.deprecate( - "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", - ) - hcloud = AnsibleHcloudServerTypeInfo(module) + hcloud.get_server_types() result = hcloud.get_result() - if is_old_facts: - 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"]} - module.exit_json(**ansible_info) + + ansible_info = {"hcloud_server_type_info": result["hcloud_server_type_info"]} + module.exit_json(**ansible_info) if __name__ == "__main__": diff --git a/plugins/modules/hcloud_ssh_key_facts.py b/plugins/modules/hcloud_ssh_key_facts.py deleted file mode 120000 index c4b0f78..0000000 --- a/plugins/modules/hcloud_ssh_key_facts.py +++ /dev/null @@ -1 +0,0 @@ -hcloud_ssh_key_info.py \ No newline at end of file diff --git a/plugins/modules/hcloud_ssh_key_info.py b/plugins/modules/hcloud_ssh_key_info.py index 757fd8c..8ff3aa6 100644 --- a/plugins/modules/hcloud_ssh_key_info.py +++ b/plugins/modules/hcloud_ssh_key_info.py @@ -10,8 +10,6 @@ module: hcloud_ssh_key_info short_description: Gather infos about your Hetzner Cloud ssh_keys. description: - Gather facts about your Hetzner Cloud ssh_keys. - - This module was called C(hcloud_ssh_key_facts) before Ansible 2.9, returning C(ansible_facts) and C(hcloud_ssh_key_facts). - Note that the M(hetzner.hcloud.hcloud_ssh_key_info) module no longer returns C(ansible_facts) and the value was renamed to C(hcloud_ssh_key_info)! author: - Christopher Schmitt (@cschmitt-hcloud) options: @@ -138,26 +136,13 @@ class AnsibleHcloudSSHKeyInfo(Hcloud): def main(): module = AnsibleHcloudSSHKeyInfo.define_module() - - is_old_facts = module._name == "hcloud_ssh_key_facts" - if is_old_facts: - module.deprecate( - "The 'hcloud_ssh_key_facts' module has been renamed to 'hcloud_ssh_key_info', " - "and the renamed one no longer returns ansible_facts", - version="2.0.0", - collection_name="hetzner.hcloud", - ) - hcloud = AnsibleHcloudSSHKeyInfo(module) + hcloud.get_ssh_keys() result = hcloud.get_result() - if is_old_facts: - ansible_info = {"hcloud_ssh_key_facts": result["hcloud_ssh_key_info"]} - module.exit_json(ansible_facts=ansible_info) - else: - ansible_info = {"hcloud_ssh_key_info": result["hcloud_ssh_key_info"]} - module.exit_json(**ansible_info) + ansible_info = {"hcloud_ssh_key_info": result["hcloud_ssh_key_info"]} + module.exit_json(**ansible_info) if __name__ == "__main__": diff --git a/plugins/modules/hcloud_volume_facts.py b/plugins/modules/hcloud_volume_facts.py deleted file mode 120000 index 1dd0312..0000000 --- a/plugins/modules/hcloud_volume_facts.py +++ /dev/null @@ -1 +0,0 @@ -hcloud_volume_info.py \ No newline at end of file diff --git a/plugins/modules/hcloud_volume_info.py b/plugins/modules/hcloud_volume_info.py index 01dc31a..bdca3b8 100644 --- a/plugins/modules/hcloud_volume_info.py +++ b/plugins/modules/hcloud_volume_info.py @@ -155,26 +155,13 @@ class AnsibleHcloudVolumeInfo(Hcloud): def main(): module = AnsibleHcloudVolumeInfo.define_module() - - is_old_facts = module._name == "hcloud_volume_facts" - if is_old_facts: - module.deprecate( - "The 'hcloud_volume_facts' module has been renamed to 'hcloud_volume_info', " - "and the renamed one no longer returns ansible_facts", - version="2.0.0", - collection_name="hetzner.hcloud", - ) - hcloud = AnsibleHcloudVolumeInfo(module) hcloud.get_volumes() result = hcloud.get_result() - if is_old_facts: - ansible_info = {"hcloud_volume_facts": result["hcloud_volume_info"]} - module.exit_json(ansible_facts=ansible_info) - else: - ansible_info = {"hcloud_volume_info": result["hcloud_volume_info"]} - module.exit_json(**ansible_info) + + ansible_info = {"hcloud_volume_info": result["hcloud_volume_info"]} + module.exit_json(**ansible_info) if __name__ == "__main__":