Ensure api_paste_conf is an absolute path
If api_paste_conf is specified as a relative path and the directory from where the nova-api service is started contains a file with the same name, the wsgi loader won't try to find the absolute path to that file which is required when not passing the base directory to the paste.deploy library. This change ensures the config_path is an absolute path so it can be found by the paste.deploy library. Closes-Bug: #1259183 Change-Id: I0eb6ef1d69d302634b8c842449f997ec10c13933
This commit is contained in:
parent
b190c0c324
commit
6037b9cc20
|
@ -44,7 +44,15 @@ class TestLoaderNothingExists(test.NoDBTestCase):
|
|||
super(TestLoaderNothingExists, self).setUp()
|
||||
self.stubs.Set(os.path, 'exists', lambda _: False)
|
||||
|
||||
def test_config_not_found(self):
|
||||
def test_relpath_config_not_found(self):
|
||||
self.flags(api_paste_config='api-paste.ini')
|
||||
self.assertRaises(
|
||||
nova.exception.ConfigNotFound,
|
||||
nova.wsgi.Loader,
|
||||
)
|
||||
|
||||
def test_asbpath_config_not_found(self):
|
||||
self.flags(api_paste_config='/etc/nova/api-paste.ini')
|
||||
self.assertRaises(
|
||||
nova.exception.ConfigNotFound,
|
||||
nova.wsgi.Loader,
|
||||
|
|
|
@ -464,11 +464,14 @@ class Loader(object):
|
|||
:returns: None
|
||||
|
||||
"""
|
||||
self.config_path = None
|
||||
|
||||
config_path = config_path or CONF.api_paste_config
|
||||
if os.path.exists(config_path):
|
||||
self.config_path = config_path
|
||||
else:
|
||||
if not os.path.isabs(config_path):
|
||||
self.config_path = CONF.find_file(config_path)
|
||||
elif os.path.exists(config_path):
|
||||
self.config_path = config_path
|
||||
|
||||
if not self.config_path:
|
||||
raise exception.ConfigNotFound(path=config_path)
|
||||
|
||||
|
|
Loading…
Reference in New Issue