diff --git a/sahara/config.py b/sahara/config.py index 6a938baa..336374be 100644 --- a/sahara/config.py +++ b/sahara/config.py @@ -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.') diff --git a/sahara/tests/integration/configs/config.py b/sahara/tests/integration/configs/config.py index 10ceffeb..79acac11 100644 --- a/sahara/tests/integration/configs/config.py +++ b/sahara/tests/integration/configs/config.py @@ -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',