Merge "Optimize the way to serach file 'glance-api-paste.ini'"
This commit is contained in:
commit
dfee2ce67e
@ -782,7 +782,7 @@ def _get_deployment_config_file():
|
|||||||
path = CONF.paste_deploy.config_file
|
path = CONF.paste_deploy.config_file
|
||||||
if not path:
|
if not path:
|
||||||
path = _get_paste_config_path()
|
path = _get_paste_config_path()
|
||||||
if not path:
|
if not path or not (os.path.isfile(os.path.abspath(path))):
|
||||||
msg = _("Unable to locate paste config file for %s.") % CONF.prog
|
msg = _("Unable to locate paste config file for %s.") % CONF.prog
|
||||||
raise RuntimeError(msg)
|
raise RuntimeError(msg)
|
||||||
return os.path.abspath(path)
|
return os.path.abspath(path)
|
||||||
|
@ -95,6 +95,13 @@ class TestPasteApp(test_utils.BaseTestCase):
|
|||||||
self._do_test_load_paste_app(expected_middleware,
|
self._do_test_load_paste_app(expected_middleware,
|
||||||
paste_config_file=paste_config_file)
|
paste_config_file=paste_config_file)
|
||||||
|
|
||||||
|
def test_load_paste_app_with_paste_config_file_but_not_exist(self):
|
||||||
|
paste_config_file = os.path.abspath("glance-registry-paste.ini")
|
||||||
|
expected_middleware = oslo_middleware.Healthcheck
|
||||||
|
self.assertRaises(RuntimeError, self._do_test_load_paste_app,
|
||||||
|
expected_middleware,
|
||||||
|
paste_config_file=paste_config_file)
|
||||||
|
|
||||||
def test_get_path_non_exist(self):
|
def test_get_path_non_exist(self):
|
||||||
self.assertRaises(RuntimeError, config._get_deployment_config_file)
|
self.assertRaises(RuntimeError, config._get_deployment_config_file)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user