Add port type on port option

According to [1]
oslo.config can use portType to support the ability to set valid range
on port option values.
[1]: http://docs.openstack.org/developer/oslo.config/cfg.html

Change-Id: Ic06b982a9127cf47b10de787a78665cbb3b2399e
This commit is contained in:
lei-zhang-99cloud 2015-08-31 14:39:12 +08:00
parent a580ceb7f3
commit 1227a53cfe
2 changed files with 8 additions and 2 deletions

View File

@ -16,6 +16,7 @@
import itertools
from oslo_config import cfg
from oslo_config import types
from oslo_log import log
from sahara import exceptions as ex
@ -28,12 +29,14 @@ from sahara.utils.openstack import keystone
from sahara.utils import remote
from sahara import version
PORT_TYPE = types.Integer(1, 65535)
cli_opts = [
cfg.StrOpt('host', default='',
help='Hostname or IP address that will be used to listen on.'),
cfg.IntOpt('port', default=8386,
help='Port that will be used to listen on.'),
cfg.Opt('port', default=8386, type=PORT_TYPE,
help='Port that will be used to listen on.'),
cfg.BoolOpt('log-exchange', default=False,
help='Log request/response exchange details: environ, '
'headers and bodies.')

View File

@ -20,6 +20,8 @@ import sys
from oslo_config import cfg
from sahara import config
def singleton(cls):
instances = {}
@ -53,6 +55,7 @@ COMMON_CONFIG_OPTS = [
default='127.0.0.1',
help='Host for Sahara.'),
cfg.IntOpt('SAHARA_PORT',
type=config.PORT_TYPE,
default=8386,
help='Port for Sahara.'),
cfg.StrOpt('SAHARA_API_VERSION',