Handle missing config file

Report a more useful error when no config file can be found.

Signed-off-by: Zane Bitter <zbitter@redhat.com>
This commit is contained in:
Zane Bitter 2012-04-11 14:03:37 +02:00
parent 7523932c5d
commit f45f677a5f
1 changed files with 8 additions and 3 deletions

View File

@ -288,9 +288,12 @@ def _get_deployment_config_file(conf):
_register_paste_deploy_opts(conf)
config_file = conf.paste_deploy.config_file
if not config_file:
if conf.config_file:
# Assume paste config is in a paste.ini file corresponding
# to the last config file
path = conf.config_file[-1].replace(".conf", "-paste.ini")
path = os.path.splitext(conf.config_file[-1])[0] + "-paste.ini"
else:
return None
else:
path = config_file
return os.path.abspath(path)
@ -317,6 +320,8 @@ def load_paste_app(conf, app_name=None):
app_name += _get_deployment_flavor(conf)
conf_file = _get_deployment_config_file(conf)
if conf_file is None:
raise RuntimeError("Unable to locate config file")
try:
# Setup logging early