From be613de636c83c1fded28851a4e00e18e6e271c8 Mon Sep 17 00:00:00 2001 From: Oleksii Chuprykov Date: Mon, 28 Sep 2015 22:01:36 +0300 Subject: [PATCH] Use pbr for installing wsgi scripts Change-Id: Ia4f6536336d860b62be6fd42465cf63d59fe2760 Closes-Bug: #1500569 --- heat/httpd/__init__.py | 0 heat/httpd/{heat-api.py => heat_api.py} | 29 +++++++++-------- .../{heat-api-cfn.py => heat_api_cfn.py} | 32 ++++++++++--------- ...i-cloudwatch.py => heat_api_cloudwatch.py} | 32 ++++++++++--------- setup.cfg | 5 +++ 5 files changed, 54 insertions(+), 44 deletions(-) create mode 100644 heat/httpd/__init__.py rename heat/httpd/{heat-api.py => heat_api.py} (60%) rename heat/httpd/{heat-api-cfn.py => heat_api_cfn.py} (60%) rename heat/httpd/{heat-api-cloudwatch.py => heat_api_cloudwatch.py} (58%) diff --git a/heat/httpd/__init__.py b/heat/httpd/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/heat/httpd/heat-api.py b/heat/httpd/heat_api.py similarity index 60% rename from heat/httpd/heat-api.py rename to heat/httpd/heat_api.py index d11ef17ce7..828aa483bc 100644 --- a/heat/httpd/heat-api.py +++ b/heat/httpd/heat_api.py @@ -26,22 +26,23 @@ from heat.common import config from heat.common.i18n import _LI from heat.common import messaging from heat.common import profiler -from heat import version +from heat import version as hversion -i18n.enable_lazy() -LOG = logging.getLogger('heat.api') +def init_application(): + i18n.enable_lazy() -logging.register_options(cfg.CONF) -version = version.version_info.version_string() -cfg.CONF(project='heat', prog='heat-api', version=version) -logging.setup(cfg.CONF, 'heat-api') -messaging.setup() + LOG = logging.getLogger('heat.api') -port = cfg.CONF.heat_api.bind_port -host = cfg.CONF.heat_api.bind_host -LOG.info(_LI('Starting Heat REST API on %(host)s:%(port)s'), - {'host': host, 'port': port}) -profiler.setup('heat-api', host) + logging.register_options(cfg.CONF) + version = hversion.version_info.version_string() + cfg.CONF(project='heat', prog='heat-api', version=version) + logging.setup(cfg.CONF, 'heat-api') + messaging.setup() -application = config.load_paste_app() + port = cfg.CONF.heat_api.bind_port + host = cfg.CONF.heat_api.bind_host + profiler.setup('heat-api', host) + LOG.info(_LI('Starting Heat REST API on %(host)s:%(port)s'), + {'host': host, 'port': port}) + return config.load_paste_app() diff --git a/heat/httpd/heat-api-cfn.py b/heat/httpd/heat_api_cfn.py similarity index 60% rename from heat/httpd/heat-api-cfn.py rename to heat/httpd/heat_api_cfn.py index 2c8d570557..77e2ef323c 100644 --- a/heat/httpd/heat-api-cfn.py +++ b/heat/httpd/heat_api_cfn.py @@ -28,22 +28,24 @@ from heat.common import messaging from heat.common import profiler from heat import version -i18n.enable_lazy() -LOG = logging.getLogger('heat.api.cfn') +def init_application(): + i18n.enable_lazy() -logging.register_options(cfg.CONF) -cfg.CONF(project='heat', - prog='heat-api-cfn', - version=version.version_info.version_string()) -logging.setup(cfg.CONF, 'heat-api-cfn') -logging.set_defaults() -messaging.setup() + LOG = logging.getLogger('heat.api.cfn') -port = cfg.CONF.heat_api_cfn.bind_port -host = cfg.CONF.heat_api_cfn.bind_host -LOG.info(_LI('Starting Heat API on %(host)s:%(port)s'), - {'host': host, 'port': port}) -profiler.setup('heat-api-cfn', host) + logging.register_options(cfg.CONF) + cfg.CONF(project='heat', + prog='heat-api-cfn', + version=version.version_info.version_string()) + logging.setup(cfg.CONF, 'heat-api-cfn') + logging.set_defaults() + messaging.setup() -application = config.load_paste_app() + port = cfg.CONF.heat_api_cfn.bind_port + host = cfg.CONF.heat_api_cfn.bind_host + LOG.info(_LI('Starting Heat API on %(host)s:%(port)s'), + {'host': host, 'port': port}) + profiler.setup('heat-api-cfn', host) + + return config.load_paste_app() diff --git a/heat/httpd/heat-api-cloudwatch.py b/heat/httpd/heat_api_cloudwatch.py similarity index 58% rename from heat/httpd/heat-api-cloudwatch.py rename to heat/httpd/heat_api_cloudwatch.py index 44308be10d..68b2cc447a 100644 --- a/heat/httpd/heat-api-cloudwatch.py +++ b/heat/httpd/heat_api_cloudwatch.py @@ -28,22 +28,24 @@ from heat.common import messaging from heat.common import profiler from heat import version -i18n.enable_lazy() -LOG = logging.getLogger('heat.api.cloudwatch') +def init_application(): + i18n.enable_lazy() -logging.register_options(cfg.CONF) -cfg.CONF(project='heat', - prog='heat-api-cloudwatch', - version=version.version_info.version_string()) -logging.setup(cfg.CONF, 'heat-api-cloudwatch') -logging.set_defaults() -messaging.setup() + LOG = logging.getLogger('heat.api.cloudwatch') -port = cfg.CONF.heat_api_cloudwatch.bind_port -host = cfg.CONF.heat_api_cloudwatch.bind_host -LOG.info(_LI('Starting Heat CloudWatch API on %(host)s:%(port)s'), - {'host': host, 'port': port}) -profiler.setup('heat-api-cloudwatch', host) + logging.register_options(cfg.CONF) + cfg.CONF(project='heat', + prog='heat-api-cloudwatch', + version=version.version_info.version_string()) + logging.setup(cfg.CONF, 'heat-api-cloudwatch') + logging.set_defaults() + messaging.setup() -application = config.load_paste_app() + port = cfg.CONF.heat_api_cloudwatch.bind_port + host = cfg.CONF.heat_api_cloudwatch.bind_host + LOG.info(_LI('Starting Heat CloudWatch API on %(host)s:%(port)s'), + {'host': host, 'port': port}) + profiler.setup('heat-api-cloudwatch', host) + + return config.load_paste_app() diff --git a/setup.cfg b/setup.cfg index 3f41ee95b2..14c79ccca7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,6 +35,11 @@ console_scripts = heat-engine = heat.cmd.engine:main heat-manage = heat.cmd.manage:main +wsgi_scripts = + heat-wsgi-api = heat.httpd.heat_api:init_application + heat-wsgi-api-cfn = heat.httpd.heat_api_cfn:init_application + heat-wsgi-api-cloudwatch = heat.httpd.heat_api_cloudwatch:init_application + oslo.config.opts = heat.common.config = heat.common.config:list_opts heat.common.crypt = heat.common.crypt:list_opts