c794e7e9ed
This patch replaces the occurence of 'tenant' by 'project'. There are still some places 'tenant' have to be used. Will try remove them when possible and necessary. Change-Id: I37d8c2545c3086d44bb3d8bd88053fc02e00c947
68 lines
2.1 KiB
Python
Executable File
68 lines
2.1 KiB
Python
Executable File
#!/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.
|
|
|
|
"""
|
|
Senlin API Server.
|
|
"""
|
|
|
|
import eventlet
|
|
eventlet.monkey_patch(os=False)
|
|
|
|
import os
|
|
import sys
|
|
|
|
# If ../senlin/__init__.py exists, add ../ to Python search path, so that
|
|
# it will override what happens to be installed in /usr/(local/)lib/python...
|
|
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
|
os.pardir,
|
|
os.pardir))
|
|
if os.path.exists(os.path.join(possible_topdir, 'senlin', '__init__.py')):
|
|
sys.path.insert(0, possible_topdir)
|
|
|
|
from oslo_config import cfg
|
|
from oslo_i18n import _lazy
|
|
from oslo_log import log as logging
|
|
import six
|
|
|
|
from senlin.common import config
|
|
from senlin.common.i18n import _LI
|
|
from senlin.common import messaging
|
|
from senlin.common import wsgi
|
|
|
|
from senlin.openstack.common import systemd
|
|
|
|
_lazy.enable_lazy()
|
|
|
|
LOG = logging.getLogger('senlin_api')
|
|
|
|
if __name__ == '__main__':
|
|
try:
|
|
logging.register_options(cfg.CONF)
|
|
cfg.CONF(project='senlin', prog='senlin-api')
|
|
logging.setup(cfg.CONF, 'senlin_api')
|
|
messaging.setup()
|
|
|
|
app = config.load_paste_app()
|
|
|
|
port = cfg.CONF.senlin_api.bind_port
|
|
host = cfg.CONF.senlin_api.bind_host
|
|
LOG.info(_LI('Starting Senlin ReST API on %(host)s:%(port)s'),
|
|
{'host': host, 'port': port})
|
|
server = wsgi.Server()
|
|
server.start(app, cfg.CONF.senlin_api, default_port=port)
|
|
systemd.notify_once()
|
|
server.wait()
|
|
except RuntimeError as ex:
|
|
sys.exit("ERROR: %s" % six.text_type(ex))
|