From 3a6fcd670c075d5a70ac576ced61ab662a7450a5 Mon Sep 17 00:00:00 2001 From: vakarisz Date: Mon, 1 Aug 2022 10:56:45 +0300 Subject: [PATCH] Common: Style improvements in ip_ranges.py --- monkey/common/agent_configuration/validators/ip_ranges.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/monkey/common/agent_configuration/validators/ip_ranges.py b/monkey/common/agent_configuration/validators/ip_ranges.py index e48939a16..5fca61b3d 100644 --- a/monkey/common/agent_configuration/validators/ip_ranges.py +++ b/monkey/common/agent_configuration/validators/ip_ranges.py @@ -47,7 +47,6 @@ def validate_hostname(hostname: str): def validate_ip_network(ip_network: str): try: IPv4Network(ip_network, strict=False) - return except (NetmaskValueError, AddressValueError): raise ValidationError(f"Invalid IPv4 network {ip_network}") @@ -56,11 +55,11 @@ def validate_ip_range(ip_range: str): try: ip_range = ip_range.replace(" ", "") ips = ip_range.split("-") - validate_ip(ips[0]) - validate_ip(ips[1]) if len(ips) != 2: raise ValidationError(f"Invalid IP range {ip_range}") - except (AddressValueError, IndexError): + validate_ip(ips[0]) + validate_ip(ips[1]) + except IndexError: raise ValidationError(f"Invalid IP range {ip_range}")