From 3be3e46d0872dad01e95ed1a5bfbca09f7f98c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20K=C3=A4mmerling?= Date: Fri, 6 Nov 2020 11:10:19 +0100 Subject: [PATCH] Adjust import fallbacks when APIException was not importable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lukas Kämmerling --- plugins/modules/hcloud_certificate.py | 2 +- plugins/modules/hcloud_certificate_info.py | 2 +- plugins/modules/hcloud_datacenter_info.py | 2 +- plugins/modules/hcloud_floating_ip_info.py | 2 +- plugins/modules/hcloud_image_info.py | 2 +- plugins/modules/hcloud_load_balancer.py | 2 +- plugins/modules/hcloud_load_balancer_service.py | 2 +- plugins/modules/hcloud_load_balancer_target.py | 3 +++ plugins/modules/hcloud_location_info.py | 2 +- plugins/modules/hcloud_network_info.py | 2 +- plugins/modules/hcloud_route.py | 2 +- plugins/modules/hcloud_server.py | 5 ++++- plugins/modules/hcloud_server_info.py | 2 +- plugins/modules/hcloud_server_network.py | 1 - plugins/modules/hcloud_server_type_info.py | 2 +- plugins/modules/hcloud_ssh_key.py | 2 +- plugins/modules/hcloud_ssh_key_info.py | 2 +- plugins/modules/hcloud_volume.py | 4 +++- plugins/modules/hcloud_volume_info.py | 2 +- 19 files changed, 25 insertions(+), 18 deletions(-) diff --git a/plugins/modules/hcloud_certificate.py b/plugins/modules/hcloud_certificate.py index 191aa10..9b6c686 100644 --- a/plugins/modules/hcloud_certificate.py +++ b/plugins/modules/hcloud_certificate.py @@ -134,7 +134,7 @@ try: from hcloud.certificates.domain import Server from hcloud import APIException except ImportError: - pass + APIException = None class AnsibleHcloudCertificate(Hcloud): diff --git a/plugins/modules/hcloud_certificate_info.py b/plugins/modules/hcloud_certificate_info.py index 705490e..479613a 100644 --- a/plugins/modules/hcloud_certificate_info.py +++ b/plugins/modules/hcloud_certificate_info.py @@ -93,7 +93,7 @@ from ansible_collections.hetzner.hcloud.plugins.module_utils.hcloud import Hclou try: from hcloud import APIException except ImportError: - pass + APIException = None class AnsibleHcloudCertificateInfo(Hcloud): diff --git a/plugins/modules/hcloud_datacenter_info.py b/plugins/modules/hcloud_datacenter_info.py index d15a2a3..6c53672 100644 --- a/plugins/modules/hcloud_datacenter_info.py +++ b/plugins/modules/hcloud_datacenter_info.py @@ -88,7 +88,7 @@ from ansible_collections.hetzner.hcloud.plugins.module_utils.hcloud import Hclou try: from hcloud import APIException except ImportError: - pass + APIException = None class AnsibleHcloudDatacenterInfo(Hcloud): diff --git a/plugins/modules/hcloud_floating_ip_info.py b/plugins/modules/hcloud_floating_ip_info.py index f3eb7da..ea335d1 100644 --- a/plugins/modules/hcloud_floating_ip_info.py +++ b/plugins/modules/hcloud_floating_ip_info.py @@ -105,7 +105,7 @@ from ansible_collections.hetzner.hcloud.plugins.module_utils.hcloud import Hclou try: from hcloud import APIException except ImportError: - pass + APIException = None class AnsibleHcloudFloatingIPInfo(Hcloud): diff --git a/plugins/modules/hcloud_image_info.py b/plugins/modules/hcloud_image_info.py index 2a126a5..658c0fa 100644 --- a/plugins/modules/hcloud_image_info.py +++ b/plugins/modules/hcloud_image_info.py @@ -111,7 +111,7 @@ from ansible_collections.hetzner.hcloud.plugins.module_utils.hcloud import Hclou try: from hcloud import APIException except ImportError: - pass + APIException = None class AnsibleHcloudImageInfo(Hcloud): diff --git a/plugins/modules/hcloud_load_balancer.py b/plugins/modules/hcloud_load_balancer.py index a09ba4f..44103b9 100644 --- a/plugins/modules/hcloud_load_balancer.py +++ b/plugins/modules/hcloud_load_balancer.py @@ -153,7 +153,7 @@ try: from hcloud.load_balancers.domain import LoadBalancer from hcloud import APIException except ImportError: - pass + APIException = None class AnsibleHcloudLoadBalancer(Hcloud): diff --git a/plugins/modules/hcloud_load_balancer_service.py b/plugins/modules/hcloud_load_balancer_service.py index 83a7034..2dd22ea 100644 --- a/plugins/modules/hcloud_load_balancer_service.py +++ b/plugins/modules/hcloud_load_balancer_service.py @@ -288,7 +288,7 @@ try: LoadBalancerServiceHealthCheck, LoadBalancerServiceHealthCheckHttp from hcloud import APIException except ImportError: - pass + APIException = None class AnsibleHcloudLoadBalancerService(Hcloud): diff --git a/plugins/modules/hcloud_load_balancer_target.py b/plugins/modules/hcloud_load_balancer_target.py index 890da71..a415886 100644 --- a/plugins/modules/hcloud_load_balancer_target.py +++ b/plugins/modules/hcloud_load_balancer_target.py @@ -147,6 +147,9 @@ try: from hcloud.load_balancers.domain import LoadBalancerTarget, LoadBalancerTargetLabelSelector, LoadBalancerTargetIP except ImportError: APIException = None + LoadBalancerTarget = None + LoadBalancerTargetLabelSelector = None + LoadBalancerTargetIP = None class AnsibleHcloudLoadBalancerTarget(Hcloud): diff --git a/plugins/modules/hcloud_location_info.py b/plugins/modules/hcloud_location_info.py index 13c1ecc..21f4774 100644 --- a/plugins/modules/hcloud_location_info.py +++ b/plugins/modules/hcloud_location_info.py @@ -87,7 +87,7 @@ from ansible_collections.hetzner.hcloud.plugins.module_utils.hcloud import Hclou try: from hcloud import APIException except ImportError: - pass + APIException = None class AnsibleHcloudLocationInfo(Hcloud): diff --git a/plugins/modules/hcloud_network_info.py b/plugins/modules/hcloud_network_info.py index b836379..7eafbde 100644 --- a/plugins/modules/hcloud_network_info.py +++ b/plugins/modules/hcloud_network_info.py @@ -187,7 +187,7 @@ from ansible_collections.hetzner.hcloud.plugins.module_utils.hcloud import Hclou try: from hcloud import APIException except ImportError: - pass + APIException = None class AnsibleHcloudNetworkInfo(Hcloud): diff --git a/plugins/modules/hcloud_route.py b/plugins/modules/hcloud_route.py index b5481a4..a428781 100644 --- a/plugins/modules/hcloud_route.py +++ b/plugins/modules/hcloud_route.py @@ -100,7 +100,7 @@ try: from hcloud.networks.domain import NetworkRoute except ImportError: APIException = None - NetworkSubnet = None + NetworkRoute = None class AnsibleHcloudRoute(Hcloud): diff --git a/plugins/modules/hcloud_server.py b/plugins/modules/hcloud_server.py index 0f83f2c..4cc4887 100644 --- a/plugins/modules/hcloud_server.py +++ b/plugins/modules/hcloud_server.py @@ -257,7 +257,10 @@ try: from hcloud.servers.domain import Server from hcloud import APIException except ImportError: - pass + APIException = None + Volume = None + SSHKey = None + Server = None class AnsibleHcloudServer(Hcloud): diff --git a/plugins/modules/hcloud_server_info.py b/plugins/modules/hcloud_server_info.py index 7cb47bd..f99d1c8 100644 --- a/plugins/modules/hcloud_server_info.py +++ b/plugins/modules/hcloud_server_info.py @@ -132,7 +132,7 @@ from ansible_collections.hetzner.hcloud.plugins.module_utils.hcloud import Hclou try: from hcloud import APIException except ImportError: - pass + APIException = None class AnsibleHcloudServerInfo(Hcloud): diff --git a/plugins/modules/hcloud_server_network.py b/plugins/modules/hcloud_server_network.py index e876834..8b0c183 100644 --- a/plugins/modules/hcloud_server_network.py +++ b/plugins/modules/hcloud_server_network.py @@ -123,7 +123,6 @@ try: from hcloud import APIException except ImportError: APIException = None - NetworkSubnet = None class AnsibleHcloudServerNetwork(Hcloud): diff --git a/plugins/modules/hcloud_server_type_info.py b/plugins/modules/hcloud_server_type_info.py index 232f3b5..5b575d9 100644 --- a/plugins/modules/hcloud_server_type_info.py +++ b/plugins/modules/hcloud_server_type_info.py @@ -102,7 +102,7 @@ from ansible_collections.hetzner.hcloud.plugins.module_utils.hcloud import Hclou try: from hcloud import APIException except ImportError: - pass + APIException = None class AnsibleHcloudServerTypeInfo(Hcloud): diff --git a/plugins/modules/hcloud_ssh_key.py b/plugins/modules/hcloud_ssh_key.py index 791f233..31c9625 100644 --- a/plugins/modules/hcloud_ssh_key.py +++ b/plugins/modules/hcloud_ssh_key.py @@ -124,7 +124,7 @@ try: from hcloud.ssh_keys.domain import Server from hcloud import APIException except ImportError: - pass + APIException = None class AnsibleHcloudSSHKey(Hcloud): diff --git a/plugins/modules/hcloud_ssh_key_info.py b/plugins/modules/hcloud_ssh_key_info.py index fa5982a..ad2b4fd 100644 --- a/plugins/modules/hcloud_ssh_key_info.py +++ b/plugins/modules/hcloud_ssh_key_info.py @@ -87,7 +87,7 @@ from ansible_collections.hetzner.hcloud.plugins.module_utils.hcloud import Hclou try: from hcloud import APIException except ImportError: - pass + APIException = None class AnsibleHcloudSSHKeyInfo(Hcloud): diff --git a/plugins/modules/hcloud_volume.py b/plugins/modules/hcloud_volume.py index b211775..5996219 100644 --- a/plugins/modules/hcloud_volume.py +++ b/plugins/modules/hcloud_volume.py @@ -169,7 +169,9 @@ try: from hcloud.servers.domain import Server import hcloud except ImportError: - pass + APIException = None + Volume = None + Server = None class AnsibleHcloudVolume(Hcloud): diff --git a/plugins/modules/hcloud_volume_info.py b/plugins/modules/hcloud_volume_info.py index 5b7e530..3006ea5 100644 --- a/plugins/modules/hcloud_volume_info.py +++ b/plugins/modules/hcloud_volume_info.py @@ -102,7 +102,7 @@ from ansible_collections.hetzner.hcloud.plugins.module_utils.hcloud import Hclou try: from hcloud import APIException except ImportError: - pass + APIException = None class AnsibleHcloudVolumeInfo(Hcloud):