2012-03-05 07:59:34 -06:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
|
|
|
2013-04-29 18:30:21 -04:00
|
|
|
# Copyright 2011 OpenStack Foundation
|
2012-03-05 07:59:34 -06:00
|
|
|
# All Rights Reserved.
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2012-03-05 21:19:09 -06:00
|
|
|
import eventlet
|
|
|
|
eventlet.monkey_patch()
|
|
|
|
|
2012-03-05 07:59:34 -06:00
|
|
|
import gettext
|
|
|
|
import optparse
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2012-05-30 15:11:34 -05:00
|
|
|
|
2013-06-19 13:44:44 -07:00
|
|
|
gettext.install('trove', unicode=1)
|
2012-03-05 07:59:34 -06:00
|
|
|
|
2012-05-30 15:11:34 -05:00
|
|
|
|
2013-06-19 13:44:44 -07:00
|
|
|
# If ../trove/__init__.py exists, add ../ to Python search path, so that
|
2012-03-05 07:59:34 -06:00
|
|
|
# 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]),
|
2013-08-29 16:03:29 +03:00
|
|
|
os.pardir,
|
|
|
|
os.pardir))
|
2013-06-19 13:44:44 -07:00
|
|
|
if os.path.exists(os.path.join(possible_topdir, 'trove', '__init__.py')):
|
2012-03-05 07:59:34 -06:00
|
|
|
sys.path.insert(0, possible_topdir)
|
|
|
|
|
2013-06-19 13:44:44 -07:00
|
|
|
from trove.common import cfg
|
|
|
|
from trove.common import rpc
|
2013-04-26 14:50:19 -07:00
|
|
|
from oslo.config import cfg as openstack_cfg
|
2013-06-19 13:44:44 -07:00
|
|
|
from trove.openstack.common import log as logging
|
|
|
|
from trove.openstack.common import service
|
|
|
|
from trove.db import get_db_api
|
2012-03-05 07:59:34 -06:00
|
|
|
|
2012-12-03 16:21:29 -06:00
|
|
|
CONF = cfg.CONF
|
|
|
|
CONF.register_opts([openstack_cfg.StrOpt('taskmanager_manager')])
|
2012-05-30 15:11:34 -05:00
|
|
|
|
2012-03-05 21:19:09 -06:00
|
|
|
if __name__ == '__main__':
|
2012-12-03 16:21:29 -06:00
|
|
|
cfg.parse_args(sys.argv)
|
|
|
|
logging.setup(None)
|
2012-03-05 07:59:34 -06:00
|
|
|
|
|
|
|
try:
|
2012-12-03 16:21:29 -06:00
|
|
|
get_db_api().configure_db(CONF)
|
|
|
|
server = rpc.RpcService(manager=CONF.taskmanager_manager)
|
|
|
|
launcher = service.launch(server)
|
|
|
|
launcher.wait()
|
2012-03-05 07:59:34 -06:00
|
|
|
except RuntimeError as error:
|
|
|
|
import traceback
|
|
|
|
print traceback.format_exc()
|
|
|
|
sys.exit("ERROR: %s" % error)
|