feat: remove deprecated facts modules (#251)

Fixes #8
This commit is contained in:
Jonas L 2023-07-05 09:32:03 +02:00 committed by GitHub
parent 3da91df8c3
commit 5190535323
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 41 additions and 200 deletions

View file

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

View file

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

View file

@ -142,8 +142,8 @@ class AnsibleHcloudCertificateInfo(Hcloud):
def main():
module = AnsibleHcloudCertificateInfo.define_module()
hcloud = AnsibleHcloudCertificateInfo(module)
hcloud.get_certificates()
result = hcloud.get_result()

View file

@ -1 +0,0 @@
hcloud_datacenter_info.py

View file

@ -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__":

View file

@ -1 +0,0 @@
hcloud_floating_ip_info.py

View file

@ -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__":

View file

@ -1 +0,0 @@
hcloud_image_info.py

View file

@ -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__":

View file

@ -378,8 +378,8 @@ class AnsibleHcloudLoadBalancerInfo(Hcloud):
def main():
module = AnsibleHcloudLoadBalancerInfo.define_module()
hcloud = AnsibleHcloudLoadBalancerInfo(module)
hcloud.get_load_balancers()
result = hcloud.get_result()

View file

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

View file

@ -1 +0,0 @@
hcloud_location_info.py

View file

@ -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__":

View file

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

View file

@ -185,7 +185,6 @@ class AnsibleHcloudPrimaryIPInfo(Hcloud):
def main():
module = AnsibleHcloudPrimaryIPInfo.define_module()
hcloud = AnsibleHcloudPrimaryIPInfo(module)
hcloud.get_primary_ips()

View file

@ -1 +0,0 @@
hcloud_server_info.py

View file

@ -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__":

View file

@ -1 +0,0 @@
hcloud_server_type_info.py

View file

@ -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__":

View file

@ -1 +0,0 @@
hcloud_ssh_key_info.py

View file

@ -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__":

View file

@ -1 +0,0 @@
hcloud_volume_info.py

View file

@ -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__":