diff --git a/cloud/azure/azure_rm_networkinterface.py b/cloud/azure/azure_rm_networkinterface.py index 2701881e105..742306ddb9f 100644 --- a/cloud/azure/azure_rm_networkinterface.py +++ b/cloud/azure/azure_rm_networkinterface.py @@ -234,8 +234,6 @@ except ImportError: pass -NAME_PATTERN = re.compile(r"^[a-z][a-z0-9-]{1,61}[a-z0-9]$") - def nic_to_dict(nic): result = dict( @@ -349,10 +347,6 @@ class AzureRMNetworkInterface(AzureRMModuleBase): # Set default location self.location = resource_group.location - if not NAME_PATTERN.match(self.name): - self.fail("Parameter error: name must begin with a letter or number, end with a letter or number " - "and contain at least one number.") - if self.state == 'present': if self.virtual_network_name and not self.subnet_name: self.fail("Parameter error: a subnet is required when passing a virtual_network_name.") diff --git a/cloud/azure/azure_rm_publicipaddress.py b/cloud/azure/azure_rm_publicipaddress.py index fb18e40bb31..fd5f07b9f30 100644 --- a/cloud/azure/azure_rm_publicipaddress.py +++ b/cloud/azure/azure_rm_publicipaddress.py @@ -125,8 +125,6 @@ except ImportError: # This is handled in azure_rm_common pass -NAME_PATTERN = re.compile(r"^[a-z][a-z0-9-]{1,61}[a-z0-9]$") - def pip_to_dict(pip): result = dict( @@ -191,10 +189,6 @@ class AzureRMPublicIPAddress(AzureRMModuleBase): # Set default location self.location = resource_group.location - if not NAME_PATTERN.match(self.name): - self.fail("Parameter error: name must begin with a letter or number, end with a letter or number " - "and contain at least one number.") - try: self.log("Fetch public ip {0}".format(self.name)) pip = self.network_client.public_ip_addresses.get(self.resource_group, self.name) diff --git a/cloud/azure/azure_rm_securitygroup.py b/cloud/azure/azure_rm_securitygroup.py index 14910328067..db24bacd409 100644 --- a/cloud/azure/azure_rm_securitygroup.py +++ b/cloud/azure/azure_rm_securitygroup.py @@ -338,8 +338,6 @@ except ImportError: # This is handled in azure_rm_common pass -NAME_PATTERN = re.compile(r"^[a-zA-Z0-9._-]+$") - def validate_rule(rule, rule_type=None): ''' @@ -352,8 +350,6 @@ def validate_rule(rule, rule_type=None): if not rule.get('name'): raise Exception("Rule name value is required.") - if not NAME_PATTERN.match(rule.get('name')): - raise Exception("Rule name must contain only word characters plus '.','-','_'") priority = rule.get('priority', None) if not priority: @@ -551,9 +547,6 @@ class AzureRMSecurityGroup(AzureRMModuleBase): # Set default location self.location = resource_group.location - if not NAME_PATTERN.match(self.name): - self.fail("Parameter error: name must contain only word characters and '.','-','_'") - if self.rules: for rule in self.rules: try: diff --git a/cloud/azure/azure_rm_storageaccount.py b/cloud/azure/azure_rm_storageaccount.py index 7f17a8b44f7..5fee11dd7d9 100644 --- a/cloud/azure/azure_rm_storageaccount.py +++ b/cloud/azure/azure_rm_storageaccount.py @@ -160,8 +160,6 @@ except ImportError: pass -NAME_PATTERN = re.compile(r"^[a-z0-9]+$") - class AzureRMStorageAccount(AzureRMModuleBase): @@ -211,9 +209,6 @@ class AzureRMStorageAccount(AzureRMModuleBase): # Set default location self.location = resource_group.location - if not NAME_PATTERN.match(self.name): - self.fail("Parameter error: name must contain numbers and lowercase letters only.") - if len(self.name) < 3 or len(self.name) > 24: self.fail("Parameter error: name length must be between 3 and 24 characters.") diff --git a/cloud/azure/azure_rm_storageblob.py b/cloud/azure/azure_rm_storageblob.py index 2479de71f78..3e5bd85ee6d 100644 --- a/cloud/azure/azure_rm_storageblob.py +++ b/cloud/azure/azure_rm_storageblob.py @@ -210,9 +210,6 @@ except ImportError: pass -NAME_PATTERN = re.compile(r"^(?!-)(?!.*--)[a-z0-9\-]+$") - - class AzureRMStorageBlob(AzureRMModuleBase): def __init__(self): @@ -270,11 +267,6 @@ class AzureRMStorageBlob(AzureRMModuleBase): self.results['check_mode'] = self.check_mode - if not NAME_PATTERN.match(self.container): - self.fail("Parameter error: container_name must consist of lowercase letters, " - "numbers and hyphens. It must begin with a letter or number. It may " - "not contain two consecutive hyphens.") - # add file path validation self.blob_client = self.get_blob_client(self.resource_group, self.storage_account_name) diff --git a/cloud/azure/azure_rm_subnet.py b/cloud/azure/azure_rm_subnet.py index 75738962f22..d11c35f2e5b 100644 --- a/cloud/azure/azure_rm_subnet.py +++ b/cloud/azure/azure_rm_subnet.py @@ -139,8 +139,6 @@ except ImportError: pass -NAME_PATTERN = re.compile(r"^[a-zA-Z0-9][a-zA-Z0-9.-_]+[a-zA-Z0-9_]$") - def subnet_to_dict(subnet): result = dict( @@ -198,10 +196,6 @@ class AzureRMSubnet(AzureRMModuleBase): for key in self.module_arg_spec: setattr(self, key, kwargs[key]) - if not NAME_PATTERN.match(self.name): - self.fail("Parameter error: name must begin with a letter or number, end with a letter, number " - "or underscore and may contain only letters, numbers, periods, underscores or hyphens.") - if self.state == 'present' and not CIDR_PATTERN.match(self.address_prefix_cidr): self.fail("Invalid address_prefix_cidr value {0}".format(self.address_prefix_cidr)) diff --git a/cloud/azure/azure_rm_virtualnetwork.py b/cloud/azure/azure_rm_virtualnetwork.py index d7bbdd00d85..417e999b635 100644 --- a/cloud/azure/azure_rm_virtualnetwork.py +++ b/cloud/azure/azure_rm_virtualnetwork.py @@ -145,8 +145,6 @@ except ImportError: pass -NAME_PATTERN = re.compile(r"^[a-zA-Z0-9]+[a-zA-Z0-9\._-]+[a-zA-Z0-9_]+$") - def virtual_network_to_dict(vnet): ''' @@ -228,10 +226,6 @@ class AzureRMVirtualNetwork(AzureRMModuleBase): # Set default location self.location = resource_group.location - if not NAME_PATTERN.match(self.name): - self.fail("Parameter error: name must begin with a letter or number, end with a letter, number " - "or underscore and may contain only letters, numbers, periods, underscores or hyphens.") - if self.state == 'present' and self.purge_address_prefixes: for prefix in self.address_prefixes_cidr: if not CIDR_PATTERN.match(prefix):