Agent: strip whitespace from IP's when generating a list of ip's
This fixes a bug where get_range_object("10.0.0.0 - 10.0.0.6") doesn't work because of the whitespaces
This commit is contained in:
parent
23a0f74b2b
commit
a0d679285c
|
@ -54,6 +54,7 @@ class NetworkRange(object, metaclass=ABCMeta):
|
||||||
def check_if_range(address_str):
|
def check_if_range(address_str):
|
||||||
if -1 != address_str.find("-"):
|
if -1 != address_str.find("-"):
|
||||||
ips = address_str.split("-")
|
ips = address_str.split("-")
|
||||||
|
ips = [ip.strip() for ip in ips]
|
||||||
try:
|
try:
|
||||||
ipaddress.ip_address(ips[0]) and ipaddress.ip_address(ips[1])
|
ipaddress.ip_address(ips[0]) and ipaddress.ip_address(ips[1])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
Loading…
Reference in New Issue