Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add comment for regex
  • Loading branch information
clnv committed Nov 23, 2023
commit 4b7cbacb3206a7a78f450b9eebcd677f43c01e49
2 changes: 2 additions & 0 deletions src/azure-cli/azure/cli/command_modules/acs/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,8 @@ def validate_allowed_host_ports(namespace):
if not host_ports:
return

# Parse the port range. The format is either `<int>/<protocol>` or `<int>-<int>/<protocol>`.
# e.g. `80/tcp` | `22/udp` | `4000-5000/tcp`
regex = re.compile(r'^((\d+)|(\d+-\d+))/(tcp|udp)$')
for port_range in host_ports.split(","):
found = regex.findall(port_range)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,8 @@ def get_allowed_host_ports(self) -> Union[List[PortRange], None]:
ports = ports.split(',')
port_ranges = []
import re
# Parse the port range. The format is either `<int>/<protocol>` or `<int>-<int>/<protocol>`.
# e.g. `80/tcp` | `22/udp` | `4000-5000/tcp`
regex = re.compile(r'^((\d+)|((\d+)-(\d+)))/(tcp|udp)$')
for port in ports:
r = regex.findall(port)
Expand Down