From 82888427f3efb57926dfb747d8923375599b5f7b Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Fri, 16 Mar 2012 10:12:45 +1100 Subject: [PATCH] Move the default port number into common.config It was defined in multiple places. Signed-off-by: Angus Salkeld --- bin/heat | 7 +++---- bin/heat-api | 2 +- heat/client.py | 1 - heat/common/config.py | 1 + 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/heat b/bin/heat index f3be4a5b9e..5a43b671f5 100755 --- a/bin/heat +++ b/bin/heat @@ -44,14 +44,13 @@ gettext.install('heat', unicode=1) from heat import client as heat_client from heat.common import exception +from heat.common import config from heat import version SUCCESS = 0 FAILURE = 1 -DEFAULT_PORT = 8000 - def catch_error(action): """Decorator to provide sensible default error handling for actions.""" def wrap(func): @@ -223,14 +222,14 @@ def create_options(parser): help="Address of heat API host. " "Default: %default") parser.add_option('-p', '--port', dest="port", metavar="PORT", - type=int, default=DEFAULT_PORT, + type=int, default=config.DEFAULT_PORT, help="Port the heat API host listens on. " "Default: %default") parser.add_option('-U', '--url', metavar="URL", default=None, help="URL of heat service. This option can be used " "to specify the hostname, port and protocol " "(http/https) of the heat server, for example " - "-U https://localhost:" + str(DEFAULT_PORT) + + "-U https://localhost:" + str(config.DEFAULT_PORT) + "/v1 Default: None") parser.add_option('-k', '--insecure', dest="insecure", default=False, action="store_true", diff --git a/bin/heat-api b/bin/heat-api index 26016f44ad..77afe9d1f2 100755 --- a/bin/heat-api +++ b/bin/heat-api @@ -48,7 +48,7 @@ if __name__ == '__main__': app = config.load_paste_app(conf) server = wsgi.Server() - server.start(app, conf, default_port=DEFAULT_PORT) + server.start(app, conf, default_port=config.DEFAULT_PORT) server.wait() except RuntimeError, e: sys.exit("ERROR: %s" % e) diff --git a/heat/client.py b/heat/client.py index 88dbf517c5..c8002c27fa 100644 --- a/heat/client.py +++ b/heat/client.py @@ -38,7 +38,6 @@ class V1Client(base_client.BaseClient): """Main client class for accessing heat resources""" - DEFAULT_PORT = 8000 DEFAULT_DOC_ROOT = "/v1" def _insert_common_parameters(self, params): diff --git a/heat/common/config.py b/heat/common/config.py index ae84325f88..b412e1f8d3 100644 --- a/heat/common/config.py +++ b/heat/common/config.py @@ -28,6 +28,7 @@ from heat import version from heat.common import cfg from heat.common import wsgi +DEFAULT_PORT = 8000 paste_deploy_group = cfg.OptGroup('paste_deploy') paste_deploy_opts = [