diff --git a/glance/common/config.py b/glance/common/config.py index 1b4fd05626..58b46f82af 100644 --- a/glance/common/config.py +++ b/glance/common/config.py @@ -144,7 +144,7 @@ def _get_deployment_config_file(default_paste_file=None): if not path: path = _get_paste_config_path(default_paste_file) if not 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) return os.path.abspath(path) diff --git a/glance/tests/unit/test_config.py b/glance/tests/unit/test_config.py index 911731b456..521b6c072a 100644 --- a/glance/tests/unit/test_config.py +++ b/glance/tests/unit/test_config.py @@ -24,7 +24,6 @@ from glance.common import config from glance.common import context from glance.image_cache import pruner -from glance.openstack.common import cfg from glance.tests import utils as test_utils @@ -40,6 +39,7 @@ def tearDown(self): def _do_test_load_paste_app(self, expected_app_type, + make_paste_file=True, paste_flavor=None, paste_config_file=None, paste_append=None): @@ -67,7 +67,7 @@ def _appendto(orig, copy, str): config.parse_args(['--config-file', temp_file]) paste_to = temp_file.replace('.conf', '-paste.ini') - if not paste_config_file: + if not paste_config_file and make_paste_file: paste_from = os.path.join(os.getcwd(), 'etc/glance-registry-paste.ini') _appendto(paste_from, paste_to, paste_append) @@ -82,6 +82,11 @@ def test_load_paste_app(self): expected_middleware = context.UnauthenticatedContextMiddleware self._do_test_load_paste_app(expected_middleware) + def test_load_paste_app_paste_config_not_found(self): + expected_middleware = context.UnauthenticatedContextMiddleware + self.assertRaises(RuntimeError, self._do_test_load_paste_app, + expected_middleware, make_paste_file=False) + def test_load_paste_app_with_paste_flavor(self): pipeline = ('[pipeline:glance-registry-incomplete]\n' 'pipeline = context registryapp')