mirror of
https://github.com/ceph/ceph
synced 2025-01-20 10:01:45 +00:00
Merge pull request #52678 from phlogistonjohn/jjm-fix-test_valid_addr
python-common: fix valid_addr on python 3.11 Reviewed-by: Adam King <adking@redhat.com>
This commit is contained in:
commit
d0b31b236a
@ -70,6 +70,9 @@ def valid_addr(addr: str) -> Tuple[bool, str]:
|
||||
colons = addr.count(':')
|
||||
addr_as_url = f'http://{addr}'
|
||||
|
||||
if addr.startswith('[') and dots:
|
||||
return False, "IPv4 address wrapped in brackets is invalid"
|
||||
|
||||
try:
|
||||
res = urlparse(addr_as_url)
|
||||
except ValueError as e:
|
||||
@ -89,9 +92,6 @@ def valid_addr(addr: str) -> Tuple[bool, str]:
|
||||
elif ']:' in addr:
|
||||
return False, 'Port must be numeric'
|
||||
|
||||
if addr.startswith('[') and dots:
|
||||
return False, "IPv4 address wrapped in brackets is invalid"
|
||||
|
||||
# catch partial address like 10.8 which would be valid IPaddress schemes
|
||||
# but are classed as invalid here since they're not usable
|
||||
if dots and addr[0].isdigit() and dots != 3:
|
||||
|
Loading…
Reference in New Issue
Block a user