mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Bug | Error message being swallowed in azure_rm_common.py (#33298)
This commit is contained in:
parent
b10859c192
commit
a18b7d9b01
8 changed files with 11 additions and 28 deletions
|
@ -415,8 +415,8 @@ class AzureRMModuleBase(object):
|
|||
'''
|
||||
try:
|
||||
return self.rm_client.resource_groups.get(resource_group)
|
||||
except CloudError:
|
||||
self.fail("Parameter error: resource group {0} not found".format(resource_group))
|
||||
except CloudError as cloud_error:
|
||||
self.fail("Error retrieving resource group {0} - {1}".format(resource_group, cloud_error.message))
|
||||
except Exception as exc:
|
||||
self.fail("Error retrieving resource group {0} - {1}".format(resource_group, str(exc)))
|
||||
|
||||
|
|
|
@ -523,10 +523,7 @@ class AzureRMContainerService(AzureRMModuleBase):
|
|||
results = dict()
|
||||
to_be_updated = False
|
||||
|
||||
try:
|
||||
resource_group = self.get_resource_group(self.resource_group)
|
||||
except CloudError:
|
||||
self.fail('resource group {} not found'.format(self.resource_group))
|
||||
resource_group = self.get_resource_group(self.resource_group)
|
||||
if not self.location:
|
||||
self.location = resource_group.location
|
||||
|
||||
|
|
|
@ -203,10 +203,7 @@ class AzureRMAvailabilitySet(AzureRMModuleBase):
|
|||
response = None
|
||||
to_be_updated = False
|
||||
|
||||
try:
|
||||
resource_group = self.get_resource_group(self.resource_group)
|
||||
except CloudError:
|
||||
self.fail('resource group {} not found'.format(self.resource_group))
|
||||
resource_group = self.get_resource_group(self.resource_group)
|
||||
if not self.location:
|
||||
self.location = resource_group.location
|
||||
|
||||
|
|
|
@ -279,8 +279,8 @@ class AzureRMRecordSet(AzureRMModuleBase):
|
|||
for key in self.module_arg_spec.keys():
|
||||
setattr(self, key, kwargs[key])
|
||||
|
||||
# get resource group and zone
|
||||
resource_group = self.get_resource_group(self.resource_group)
|
||||
# retrieve resource group to make sure it exists
|
||||
self.get_resource_group(self.resource_group)
|
||||
zone = self.dns_client.zones.get(self.resource_group, self.zone_name)
|
||||
if not zone:
|
||||
self.fail('The zone {0} does not exist in the resource group {1}'.format(self.zone_name, self.resource_group))
|
||||
|
|
|
@ -143,7 +143,7 @@ class AzureRMDNSZone(AzureRMModuleBase):
|
|||
self.results['check_mode'] = self.check_mode
|
||||
|
||||
# retrieve resource group to make sure it exists
|
||||
resource_group = self.get_resource_group(self.resource_group)
|
||||
self.get_resource_group(self.resource_group)
|
||||
|
||||
changed = False
|
||||
results = dict()
|
||||
|
|
|
@ -324,11 +324,7 @@ class AzureRMLoadBalancer(AzureRMModuleBase):
|
|||
pip = None
|
||||
load_balancer_props = dict()
|
||||
|
||||
try:
|
||||
resource_group = self.get_resource_group(self.resource_group)
|
||||
except CloudError:
|
||||
self.fail('resource group {} not found'.format(self.resource_group))
|
||||
|
||||
resource_group = self.get_resource_group(self.resource_group)
|
||||
if not self.location:
|
||||
self.location = resource_group.location
|
||||
load_balancer_props['location'] = self.location
|
||||
|
|
|
@ -234,12 +234,8 @@ class AzureRMManagedDisk(AzureRMModuleBase):
|
|||
results = dict()
|
||||
resource_group = None
|
||||
response = None
|
||||
try:
|
||||
resource_group = self.get_resource_group(self.resource_group)
|
||||
except CloudError:
|
||||
self.fail(
|
||||
'resource group {} not found'
|
||||
.format(self.resource_group))
|
||||
|
||||
resource_group = self.get_resource_group(self.resource_group)
|
||||
if not self.location:
|
||||
self.location = resource_group.location
|
||||
if self.state == 'present':
|
||||
|
|
|
@ -227,10 +227,7 @@ class AzureRMVMExtension(AzureRMModuleBase):
|
|||
response = None
|
||||
to_be_updated = False
|
||||
|
||||
try:
|
||||
resource_group = self.get_resource_group(self.resource_group)
|
||||
except CloudError:
|
||||
self.fail('resource group {} not found'.format(self.resource_group))
|
||||
resource_group = self.get_resource_group(self.resource_group)
|
||||
if not self.location:
|
||||
self.location = resource_group.location
|
||||
|
||||
|
|
Loading…
Reference in a new issue