2
# vim: tabstop=4 shiftwidth=4 softtabstop=4
4
# Copyright 2010 United States Government as represented by the
5
# Administrator of the National Aeronautics and Space Administration.
6
# Copyright 2011 OpenStack LLC.
9
# Licensed under the Apache License, Version 2.0 (the "License"); you may
10
# not use this file except in compliance with the License. You may obtain
11
# a copy of the License at
13
# http://www.apache.org/licenses/LICENSE-2.0
15
# Unless required by applicable law or agreed to in writing, software
16
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
18
# License for the specific language governing permissions and limitations
22
Keystone Identity Server - Admin API
29
# If ../../keystone/__init__.py exists, add ../ to Python search path, so that
30
# it will override what happens to be installed in /usr/(local/)lib/python...
31
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
34
if os.path.exists(os.path.join(possible_topdir, 'keystone', '__init__.py')):
35
sys.path.insert(0, possible_topdir)
37
import tools.tracer # @UnusedImport # module runs on import
39
from keystone.common import config, wsgi
42
if __name__ == '__main__':
43
# Initialize a parser for our configuration paramaters
44
parser = optparse.OptionParser(version='%%prog %s' % keystone.version)
45
common_group = config.add_common_options(parser)
46
config.add_log_options(parser)
48
# Parse arguments and load config
49
(options, args) = config.parse_options(parser)
50
config_file = config.find_config_file(options, args)
54
# Load Admin API server
55
conf, app = config.load_paste_app('admin', options, args)
57
debug = options.get('debug') or conf.get('debug', False)
58
debug = debug in [True, "True", "1"]
59
verbose = options.get('verbose') or conf.get('verbose', False)
60
verbose = verbose in [True, "True", "1"]
62
print "Using config file:", config_file
64
server = wsgi.Server()
65
server.start(app, int(conf['admin_port']), conf['admin_host'])
67
print "Admin API listening on %s:%s" % (
68
conf['admin_host'], conf['admin_port'])
71
except RuntimeError, e:
72
sys.exit("ERROR: %s" % e)