Remove object name validation.

reviewable/pr18780/r1
Chris Houseknecht 8 years ago
parent 2373810034
commit bb582ae574
No known key found for this signature in database
GPG Key ID: 78F1698C5705A81B

@ -234,8 +234,6 @@ except ImportError:
pass pass
NAME_PATTERN = re.compile(r"^[a-z][a-z0-9-]{1,61}[a-z0-9]$")
def nic_to_dict(nic): def nic_to_dict(nic):
result = dict( result = dict(
@ -349,10 +347,6 @@ class AzureRMNetworkInterface(AzureRMModuleBase):
# Set default location # Set default location
self.location = resource_group.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.state == 'present':
if self.virtual_network_name and not self.subnet_name: if self.virtual_network_name and not self.subnet_name:
self.fail("Parameter error: a subnet is required when passing a virtual_network_name.") self.fail("Parameter error: a subnet is required when passing a virtual_network_name.")

@ -125,8 +125,6 @@ except ImportError:
# This is handled in azure_rm_common # This is handled in azure_rm_common
pass pass
NAME_PATTERN = re.compile(r"^[a-z][a-z0-9-]{1,61}[a-z0-9]$")
def pip_to_dict(pip): def pip_to_dict(pip):
result = dict( result = dict(
@ -191,10 +189,6 @@ class AzureRMPublicIPAddress(AzureRMModuleBase):
# Set default location # Set default location
self.location = resource_group.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: try:
self.log("Fetch public ip {0}".format(self.name)) self.log("Fetch public ip {0}".format(self.name))
pip = self.network_client.public_ip_addresses.get(self.resource_group, self.name) pip = self.network_client.public_ip_addresses.get(self.resource_group, self.name)

@ -338,8 +338,6 @@ except ImportError:
# This is handled in azure_rm_common # This is handled in azure_rm_common
pass pass
NAME_PATTERN = re.compile(r"^[a-zA-Z0-9._-]+$")
def validate_rule(rule, rule_type=None): def validate_rule(rule, rule_type=None):
''' '''
@ -352,8 +350,6 @@ def validate_rule(rule, rule_type=None):
if not rule.get('name'): if not rule.get('name'):
raise Exception("Rule name value is required.") 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) priority = rule.get('priority', None)
if not priority: if not priority:
@ -551,9 +547,6 @@ class AzureRMSecurityGroup(AzureRMModuleBase):
# Set default location # Set default location
self.location = resource_group.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: if self.rules:
for rule in self.rules: for rule in self.rules:
try: try:

@ -160,8 +160,6 @@ except ImportError:
pass pass
NAME_PATTERN = re.compile(r"^[a-z0-9]+$")
class AzureRMStorageAccount(AzureRMModuleBase): class AzureRMStorageAccount(AzureRMModuleBase):
@ -211,9 +209,6 @@ class AzureRMStorageAccount(AzureRMModuleBase):
# Set default location # Set default location
self.location = resource_group.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: if len(self.name) < 3 or len(self.name) > 24:
self.fail("Parameter error: name length must be between 3 and 24 characters.") self.fail("Parameter error: name length must be between 3 and 24 characters.")

@ -210,9 +210,6 @@ except ImportError:
pass pass
NAME_PATTERN = re.compile(r"^(?!-)(?!.*--)[a-z0-9\-]+$")
class AzureRMStorageBlob(AzureRMModuleBase): class AzureRMStorageBlob(AzureRMModuleBase):
def __init__(self): def __init__(self):
@ -270,11 +267,6 @@ class AzureRMStorageBlob(AzureRMModuleBase):
self.results['check_mode'] = self.check_mode 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 # add file path validation
self.blob_client = self.get_blob_client(self.resource_group, self.storage_account_name) self.blob_client = self.get_blob_client(self.resource_group, self.storage_account_name)

@ -139,8 +139,6 @@ except ImportError:
pass pass
NAME_PATTERN = re.compile(r"^[a-zA-Z0-9][a-zA-Z0-9.-_]+[a-zA-Z0-9_]$")
def subnet_to_dict(subnet): def subnet_to_dict(subnet):
result = dict( result = dict(
@ -198,10 +196,6 @@ class AzureRMSubnet(AzureRMModuleBase):
for key in self.module_arg_spec: for key in self.module_arg_spec:
setattr(self, key, kwargs[key]) 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): 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)) self.fail("Invalid address_prefix_cidr value {0}".format(self.address_prefix_cidr))

@ -145,8 +145,6 @@ except ImportError:
pass pass
NAME_PATTERN = re.compile(r"^[a-zA-Z0-9]+[a-zA-Z0-9\._-]+[a-zA-Z0-9_]+$")
def virtual_network_to_dict(vnet): def virtual_network_to_dict(vnet):
''' '''
@ -228,10 +226,6 @@ class AzureRMVirtualNetwork(AzureRMModuleBase):
# Set default location # Set default location
self.location = resource_group.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: if self.state == 'present' and self.purge_address_prefixes:
for prefix in self.address_prefixes_cidr: for prefix in self.address_prefixes_cidr:
if not CIDR_PATTERN.match(prefix): if not CIDR_PATTERN.match(prefix):

Loading…
Cancel
Save