normalize the resource location (#40802)

(cherry picked from commit e6e08a0174)
This commit is contained in:
Yuwei Zhou 2018-06-04 13:45:51 +08:00 committed by Matt Clay
parent adef72393e
commit 96929acd5e
2 changed files with 5 additions and 2 deletions

View file

@ -311,7 +311,7 @@ except ImportError:
# This is handled in azure_rm_common # This is handled in azure_rm_common
pass pass
from ansible.module_utils.azure_rm_common import AzureRMModuleBase, azure_id_to_dict from ansible.module_utils.azure_rm_common import AzureRMModuleBase, azure_id_to_dict, normalize_location_name
from ansible.module_utils._text import to_native from ansible.module_utils._text import to_native
@ -446,6 +446,7 @@ class AzureRMNetworkInterface(AzureRMModuleBase):
if not self.location: if not self.location:
# Set default location # Set default location
self.location = resource_group.location self.location = resource_group.location
self.location = normalize_location_name(self.location)
# parse the virtual network resource group and name # parse the virtual network resource group and name
self.virtual_network = self.parse_resource_to_dict(self.virtual_network) self.virtual_network = self.parse_resource_to_dict(self.virtual_network)

View file

@ -614,7 +614,7 @@ except ImportError:
pass pass
from ansible.module_utils.basic import to_native, to_bytes from ansible.module_utils.basic import to_native, to_bytes
from ansible.module_utils.azure_rm_common import AzureRMModuleBase, azure_id_to_dict from ansible.module_utils.azure_rm_common import AzureRMModuleBase, azure_id_to_dict, normalize_location_name
AZURE_OBJECT_CLASS = 'VirtualMachine' AZURE_OBJECT_CLASS = 'VirtualMachine'
@ -742,6 +742,8 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
# Set default location # Set default location
self.location = resource_group.location self.location = resource_group.location
self.location = normalize_location_name(self.location)
if self.state == 'present': if self.state == 'present':
# Verify parameters and resolve any defaults # Verify parameters and resolve any defaults