Skip to content

Commit

Permalink
{AKS} Fix #17681: Fix az aks create error if name contains characte… (
Browse files Browse the repository at this point in the history
  • Loading branch information
RakeshMohanMSFT committed Jul 21, 2022
1 parent c35e7f1 commit 1236137
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/azure-cli/azure/cli/command_modules/acs/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ def validate_linux_host_name(namespace):
in the CLI pre-flight.
"""
# https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address
rfc1123_regex = re.compile(r'^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$') # pylint:disable=line-too-long
rfc1123_regex = re.compile(r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$') # pylint:disable=line-too-long
found = rfc1123_regex.findall(namespace.name)
if not found:
raise CLIError('--name cannot exceed 63 characters and can only contain '
'letters, numbers, or dashes (-).')
raise InvalidArgumentValueError('--name cannot exceed 63 characters and can only contain '
'letters, numbers, underscores (_) or dashes (-).')


def validate_snapshot_name(namespace):
Expand Down

0 comments on commit 1236137

Please sign in to comment.