From: Sumit Naiksatam Date: Thu, 1 Aug 2013 06:25:59 +0000 (-0700) Subject: Followup fixes to FWaaS API patch X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ab1a932872a6ff7821b7723879d6d75ab3b7154f;p=openstack-build%2Fneutron-build.git Followup fixes to FWaaS API patch Fixes: bug #1206620 This adds the minor fixes which were suggested be fixed as a followup to the FWaaS API patch. Change-Id: I8112dcb4f750bb367dcc6464cda7a826b7be811e --- diff --git a/neutron/db/firewall/firewall_db.py b/neutron/db/firewall/firewall_db.py index 846171f37..1e1f1ac8e 100644 --- a/neutron/db/firewall/firewall_db.py +++ b/neutron/db/firewall/firewall_db.py @@ -211,13 +211,10 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin): def _get_min_max_ports_from_range(self, port_range): if not port_range: return [None, None] - ports = port_range.split(':') - ports[0] = int(ports[0]) - if len(ports) < 2: - ports.append(ports[0]) - else: - ports[1] = int(ports[1]) - return ports + min_port, sep, max_port = port_range.partition(":") + if not max_port: + max_port = min_port + return [int(min_port), int(max_port)] def _get_port_range_from_min_max_ports(self, min_port, max_port): if not min_port: @@ -225,7 +222,7 @@ class Firewall_db_mixin(firewall.FirewallPluginBase, base_db.CommonDbMixin): if min_port == max_port: return str(min_port) else: - return str(min_port) + ':' + str(max_port) + return '%d:%d' % (min_port, max_port) def create_firewall(self, context, firewall): LOG.debug(_("create_firewall() called")) diff --git a/neutron/extensions/firewall.py b/neutron/extensions/firewall.py index ca7530e5f..c0ace893d 100644 --- a/neutron/extensions/firewall.py +++ b/neutron/extensions/firewall.py @@ -86,7 +86,7 @@ class FirewallInvalidPortValue(qexception.InvalidInput): class FirewallRuleInfoMissing(qexception.InvalidInput): message = _("Missing rule info argument for insert/remove " - "rule opertaion.") + "rule operation.") fw_valid_protocol_values = [None, constants.TCP, constants.UDP, constants.ICMP]