From f45f677a5f11d33990c7edef653a283317a55f38 Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Wed, 11 Apr 2012 14:03:37 +0200 Subject: [PATCH] Handle missing config file Report a more useful error when no config file can be found. Signed-off-by: Zane Bitter --- heat/common/config.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/heat/common/config.py b/heat/common/config.py index 0bdb418b12..6d33d056ea 100644 --- a/heat/common/config.py +++ b/heat/common/config.py @@ -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: - # Assume paste config is in a paste.ini file corresponding - # to the last config file - path = conf.config_file[-1].replace(".conf", "-paste.ini") + if conf.config_file: + # Assume paste config is in a paste.ini file corresponding + # to the last config file + 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