diff --git a/bin/glance-api b/bin/glance-api index 12b5aca..405d232 100755 --- a/bin/glance-api +++ b/bin/glance-api @@ -54,14 +54,14 @@ def fail(returncode, e): if __name__ == '__main__': try: - config.parse_args() + config.parse_args(default_config_files=['/etc/glance/glance-api.conf']) log.setup('glance') glance.store.create_stores() glance.store.verify_default_store() server = wsgi.Server() - server.start(config.load_paste_app(), default_port=9292) + server.start(config.load_paste_app('glance-api'), default_port=9292) server.wait() except exception.WorkerCreationFailure, e: fail(2, e) diff --git a/bin/glance-registry b/bin/glance-registry index e6e9a98..b7a0a56 100755 --- a/bin/glance-registry +++ b/bin/glance-registry @@ -47,11 +47,12 @@ from glance.openstack.common import log if __name__ == '__main__': try: - config.parse_args() + config.parse_args(default_config_files=['/etc/glance/glance-registry.conf']) log.setup('glance') server = wsgi.Server() - server.start(config.load_paste_app(), default_port=9191) + server.start(config.load_paste_app('glance-registry'), + default_port=9191) server.wait() except RuntimeError, e: sys.exit("ERROR: %s" % e) diff --git a/bin/glance-scrubber b/bin/glance-scrubber index c1c2365..fa66517 100755 --- a/bin/glance-scrubber +++ b/bin/glance-scrubber @@ -58,7 +58,7 @@ if __name__ == '__main__': try: - config.parse_args() + config.parse_args(default_config_files=['/etc/glance/glance-scrubber.conf']) log.setup('glance') glance.store.create_stores() diff --git a/glance/common/config.py b/glance/common/config.py index 2566a50..a024850 100644 --- a/glance/common/config.py +++ b/glance/common/config.py @@ -157,7 +157,7 @@ def _get_deployment_flavor(): return '' if not flavor else ('-' + flavor) -def _get_paste_config_path(): +def _get_paste_config_path(app_name): paste_suffix = '-paste.ini' conf_suffix = '.conf' if CONF.config_file: @@ -165,25 +165,25 @@ def _get_paste_config_path(): # to the last config file path = CONF.config_file[-1].replace(conf_suffix, paste_suffix) else: - path = CONF.prog + '-paste.ini' + path = app_name + paste_suffix return CONF.find_file(os.path.basename(path)) -def _get_deployment_config_file(): +def _get_deployment_config_file(app_name): """ Retrieve the deployment_config_file config item, formatted as an absolute pathname. """ path = CONF.paste_deploy.config_file if not path: - path = _get_paste_config_path() + path = _get_paste_config_path(app_name) if not path: msg = "Unable to locate paste config file for %s." % CONF.prog raise RuntimeError(msg) return os.path.abspath(path) -def load_paste_app(app_name=None): +def load_paste_app(app_name): """ Builds and returns a WSGI app from a paste config file. @@ -195,14 +195,11 @@ def load_paste_app(app_name=None): :raises RuntimeError when config file cannot be located or application cannot be loaded from config file """ - if app_name is None: - app_name = CONF.prog - # append the deployment flavor to the application name, # in order to identify the appropriate paste pipeline app_name += _get_deployment_flavor() - conf_file = _get_deployment_config_file() + conf_file = _get_deployment_config_file(app_name) try: logger = logging.getLogger(__name__)