diff --git a/magnum/api/app.py b/magnum/api/app.py index a54537a42a..aa95f5d540 100644 --- a/magnum/api/app.py +++ b/magnum/api/app.py @@ -80,7 +80,7 @@ def load_app(): cfg_file = cfg_path if not cfg_file: - raise cfg.ConfigFilesNotFoundError([cfg.CONF.api_paste_config]) + raise cfg.ConfigFilesNotFoundError([cfg.CONF.api.api_paste_config]) LOG.info(_("Full WSGI config used: %s") % cfg_file) return deploy.loadapp("config:" + cfg_file) diff --git a/magnum/tests/unit/api/controllers/test_root.py b/magnum/tests/unit/api/controllers/test_root.py index c5da1bcac4..727ee4df98 100644 --- a/magnum/tests/unit/api/controllers/test_root.py +++ b/magnum/tests/unit/api/controllers/test_root.py @@ -102,6 +102,13 @@ class TestRootController(api_base.FunctionalTest): response = self.app.get('/a/bogus/url', expect_errors=True) assert response.status_int == 404 + def test_api_paste_file_not_exist(self): + cfg.CONF.set_override('api_paste_config', 'non-existent-file', + group='api') + with mock.patch.object(cfg.CONF, 'find_file') as ff: + ff.return_value = None + self.assertRaises(cfg.ConfigFilesNotFoundError, app.load_app) + def test_noauth(self): # Don't need to auth paste_file = "magnum/tests/unit/api/controllers/noauth-paste.ini"