summaryrefslogtreecommitdiff
path: root/trove/extensions
diff options
context:
space:
mode:
authorTrevor McCasland <TM2086@att.com>2016-10-31 13:19:47 -0500
committerTrevor McCasland <TM2086@att.com>2017-06-01 13:36:02 -0500
commit91d443e06b50143a707235363bff9ab97d68a8f4 (patch)
tree6add0b0757967dd7a1ad4abd5fc3cfb62042a571 /trove/extensions
parent321b38219c23edac4d3918ad8a86b5b57fc69ad3 (diff)
downloadtrove-91d443e06b50143a707235363bff9ab97d68a8f4.tar.gz
Improve list-of-ports validation
List options tcp_ports and udp_ports are lists of strings and some with a '-' in the middle to indicate a range. To help validate the options better a new type was introduced to oslo.config called Range. oslo.config version 3.18.0 merged this Range type which will no longer require the following in our project: * utility function gen_ports because a Range of ints are returned * test to check for proper from-to format, the type is smart so it flips the numbers around for us. So 63000-300 returns Range(300, 63001) 63001 because inclusion=True is set by default. Change-Id: I63b6a865a3f3c79202dd299f6cd25dd59e182252 Closes-Bug: #1500141
Diffstat (limited to 'trove/extensions')
-rw-r--r--trove/extensions/security_group/service.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/trove/extensions/security_group/service.py b/trove/extensions/security_group/service.py
index 5a8c8bb4..d28cd185 100644
--- a/trove/extensions/security_group/service.py
+++ b/trove/extensions/security_group/service.py
@@ -19,7 +19,6 @@ from oslo_log import log as logging
from trove.common import cfg
from trove.common import exception
from trove.common.i18n import _
-from trove.common import utils
from trove.common import wsgi
from trove.datastore.models import DatastoreVersion
from trove.extensions.security_group import models
@@ -103,9 +102,9 @@ class SecurityGroupRuleController(wsgi.Controller):
rules = []
try:
for port_or_range in set(ports):
- from_, to_ = utils.gen_ports(port_or_range)
+ from_, to_ = port_or_range[0], port_or_range[-1]
rule = models.SecurityGroupRule.create_sec_group_rule(
- sec_group, protocol, int(from_), int(to_),
+ sec_group, protocol, from_, to_,
body['security_group_rule']['cidr'], context,
CONF.os_region_name)
rules.append(rule)