Add support to have Senlin API run under Apache
Add scripts for running Senlin API service under apache2, will add related devstack support in another patch. Implements bp: run-senlin-api-under-apache Change-Id: I18872546a653c5de26360b6289dd1f5886c4a2b7
This commit is contained in:
@@ -673,7 +673,13 @@ class Resource(object):
|
||||
# Attach openstack-api-version header
|
||||
if hasattr(response, 'headers'):
|
||||
for hdr, val in response.headers.items():
|
||||
response.headers[hdr] = six.text_type(val)
|
||||
# Note(lvdongbing): Ensure header is a python 2 or 3
|
||||
# native string (thus not unicode in python 2 but stay
|
||||
# a string in python 3). Because mod-wsgi checks that
|
||||
# response header values are what's described as
|
||||
# "native strings". This means whatever `str` is in
|
||||
# either python 2 or 3, but never `unicode`.
|
||||
response.headers[hdr] = str(val)
|
||||
ver = request.version_request
|
||||
if not ver.is_null():
|
||||
ver_res = ' '.join(['clustering', str(ver)])
|
||||
|
||||
41
senlin/cmd/api_wsgi.py
Normal file
41
senlin/cmd/api_wsgi.py
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""WSGI script for senlin-api.
|
||||
|
||||
Use this file for deploying senlin-api under Apache2(mode-wsgi).
|
||||
"""
|
||||
|
||||
|
||||
from oslo_config import cfg
|
||||
import oslo_i18n as i18n
|
||||
from oslo_log import log as logging
|
||||
|
||||
from senlin.api.common import wsgi
|
||||
from senlin.common import messaging
|
||||
from senlin.common import profiler
|
||||
from senlin import version
|
||||
|
||||
|
||||
def init_app():
|
||||
i18n.enable_lazy()
|
||||
|
||||
logging.register_options(cfg.CONF)
|
||||
cfg.CONF(project='senlin', prog='senlin-api',
|
||||
version=version.version_info.version_string())
|
||||
logging.setup(cfg.CONF, 'senlin-api')
|
||||
messaging.setup()
|
||||
|
||||
profiler.setup('senlin-api', cfg.CONF.host)
|
||||
return wsgi.load_paste_app()
|
||||
Reference in New Issue
Block a user