From ab1a932872a6ff7821b7723879d6d75ab3b7154f Mon Sep 17 00:00:00 2001 From: Sumit Naiksatam Date: Wed, 31 Jul 2013 23:25:59 -0700 Subject: [PATCH] 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 --- neutron/db/firewall/firewall_db.py | 13 +++++-------- neutron/extensions/firewall.py | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) 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] -- 2.45.2