X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fopenstack%2Fsecurity_group.py;h=4af0e581c85fa59a5213a8f813a99923a42d74a3;hb=1db1a879ffde8991aa95dd80142d555551655e88;hp=33c627433f4f582086382585bfdf37e2ffe70cf7;hpb=951442dd2320e49e39807476ffc248377886c00f;p=sfa.git diff --git a/sfa/openstack/security_group.py b/sfa/openstack/security_group.py index 33c62743..4af0e581 100644 --- a/sfa/openstack/security_group.py +++ b/sfa/openstack/security_group.py @@ -24,14 +24,12 @@ class SecurityGroup: def _validate_port_range(self, port_range): from_port = to_port = None if isinstance(port_range, str): - ports = port_range.split('-') + ports = port_range.split(':') if len(ports) > 1: from_port = int(ports[0]) to_port = int(ports[1]) else: from_port = to_port = int(ports[0]) - else: - from_port = to_port = None return (from_port, to_port) def _validate_icmp_type_code(self, icmp_type_code): @@ -53,7 +51,7 @@ class SecurityGroup: from_port, to_port = self._validate_port_range(port_range) icmp_type = self._validate_icmp_type_code(icmp_type_code) - if icmp_type: + if icmp_type and icmp_type[0] and icmp_type[1]: from_port, to_port = icmp_type[0], icmp_type[1] if group_name: