From f958f457f0fdae43abff38f3503ac47dfd9ed52e Mon Sep 17 00:00:00 2001 From: Fred-sun Date: Wed, 29 Dec 2021 17:33:41 +0800 Subject: [PATCH] fix azure_rm_hostgroup module --- plugins/modules/azure_rm_hostgroup.py | 2 +- plugins/modules/azure_rm_hostgroup_info.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/modules/azure_rm_hostgroup.py b/plugins/modules/azure_rm_hostgroup.py index e091273034..2f44b8012c 100644 --- a/plugins/modules/azure_rm_hostgroup.py +++ b/plugins/modules/azure_rm_hostgroup.py @@ -226,7 +226,7 @@ def exec_module(self, **kwargs): elif self.state == 'absent': changed = True - except CloudError: + except Exception: if self.state == 'present': changed = True else: diff --git a/plugins/modules/azure_rm_hostgroup_info.py b/plugins/modules/azure_rm_hostgroup_info.py index d9d4d650a2..5d89bbd8e0 100644 --- a/plugins/modules/azure_rm_hostgroup_info.py +++ b/plugins/modules/azure_rm_hostgroup_info.py @@ -139,7 +139,7 @@ def get_item(self): # get specific host group try: item = self.compute_client.dedicated_host_groups.get(self.resource_group, self.name) - except CloudError: + except Exception: pass # serialize result @@ -151,7 +151,7 @@ def list_resource_group(self): self.log('List all host groups for resource group - {0}'.format(self.resource_group)) try: response = self.compute_client.dedicated_host_groups.list_by_resource_group(self.resource_group) - except AzureHttpError as exc: + except Exception as exc: self.fail("Failed to list for resource group {0} - {1}".format(self.resource_group, str(exc))) results = [] @@ -164,7 +164,7 @@ def list_items(self): self.log('List all host groups for a subscription ') try: response = self.compute_client.dedicated_host_groups.list_by_subscription() - except AzureHttpError as exc: + except Exception as exc: self.fail("Failed to list all items - {0}".format(str(exc))) results = []