diff options
author | Jenkins <jenkins@review.openstack.org> | 2012-05-11 01:42:15 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2012-05-11 01:42:15 +0000 |
commit | bf6673a5952ed59ed55d504938d195083e23a2ce (patch) | |
tree | c2dedeb00a9ff4d5096f74d54f794a3d5304b89f | |
parent | 8aef8b83973843ca8cf7e2add0698690b99b7c11 (diff) | |
parent | 16c5dbf156f5aafe113d9ac2c26e99b0e621724d (diff) | |
download | nova-bf6673a5952ed59ed55d504938d195083e23a2ce.tar.gz nova-bf6673a5952ed59ed55d504938d195083e23a2ce.tar.xz nova-bf6673a5952ed59ed55d504938d195083e23a2ce.zip |
Merge "Use ConfigOpts.find_file() to find paste config"
-rw-r--r-- | nova/tests/fake_flags.py | 1 | ||||
-rw-r--r-- | nova/utils.py | 23 | ||||
-rw-r--r-- | nova/wsgi.py | 10 |
3 files changed, 10 insertions, 24 deletions
diff --git a/nova/tests/fake_flags.py b/nova/tests/fake_flags.py index 598fb3afc..9f0c9983d 100644 --- a/nova/tests/fake_flags.py +++ b/nova/tests/fake_flags.py @@ -43,3 +43,4 @@ FLAGS.set_default('flat_network_bridge', 'br100') FLAGS.set_default('sqlite_synchronous', False) flags.DECLARE('policy_file', 'nova.policy') flags.DECLARE('compute_scheduler_driver', 'nova.scheduler.multi') +FLAGS.set_default('api_paste_config', '$state_path/etc/nova/api-paste.ini') diff --git a/nova/utils.py b/nova/utils.py index 2a90c3055..fea255a26 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -71,29 +71,6 @@ FLAGS.register_opt( help='Whether to disable inter-process locks')) -def find_config(config_path): - """Find a configuration file using the given hint. - - :param config_path: Full or relative path to the config. - :returns: Full path of the config, if it exists. - :raises: `nova.exception.ConfigNotFound` - - """ - possible_locations = [ - config_path, - os.path.join(FLAGS.state_path, "etc", "nova", config_path), - os.path.join(FLAGS.state_path, "etc", config_path), - os.path.join(FLAGS.state_path, config_path), - "/etc/nova/%s" % config_path, - ] - - for path in possible_locations: - if os.path.exists(path): - return os.path.abspath(path) - - raise exception.ConfigNotFound(path=os.path.abspath(config_path)) - - def vpn_ping(address, port, timeout=0.05, session_id=None): """Sends a vpn negotiation packet and returns the server session. diff --git a/nova/wsgi.py b/nova/wsgi.py index acd01e7d1..118fd14e1 100644 --- a/nova/wsgi.py +++ b/nova/wsgi.py @@ -19,6 +19,7 @@ """Utility methods for working with WSGI servers.""" +import os.path import sys import eventlet @@ -357,7 +358,12 @@ class Loader(object): """ config_path = config_path or FLAGS.api_paste_config - self.config_path = utils.find_config(config_path) + if os.path.exists(config_path): + self.config_path = config_path + else: + self.config_path = FLAGS.find_file(config_path) + if not self.config_path: + raise exception.ConfigNotFound(path=config_path) def load_app(self, name): """Return the paste URLMap wrapped WSGI application. @@ -368,6 +374,8 @@ class Loader(object): """ try: + LOG.debug(_("Loading app %(name)s from %(path)s") % + {'name': name, 'path': self.config_path}) return deploy.loadapp("config:%s" % self.config_path, name=name) except LookupError as err: LOG.error(err) |