]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Fix the handling of non-existing paste file
authorAngus Salkeld <asalkeld@redhat.com>
Tue, 28 May 2013 02:06:28 +0000 (12:06 +1000)
committerAngus Salkeld <asalkeld@redhat.com>
Tue, 28 May 2013 02:06:28 +0000 (12:06 +1000)
First only call find_file() by it's self so we can check for None
(abspath crashes if you pass it None)
We are already calling abspath at the return, so this
also prevents a double call to abspath.

If return None from _get_deployment_config_file() load_paste_app() will
print out a nice error message.

Change-Id: I451e090b7f08266ca824b5da228dafde55726d94

heat/common/config.py

index 628157dd19ad250bbab602b0f3d48abc245500f6..02ae986c462a5a964c6b6aec5c64a323513d85c8 100644 (file)
@@ -155,8 +155,10 @@ def _get_deployment_config_file():
     absolute pathname.
     """
     _register_paste_deploy_opts()
-    config_path = os.path.abspath(cfg.CONF.find_file(
-        cfg.CONF.paste_deploy['api_paste_config']))
+    config_path = cfg.CONF.find_file(
+        cfg.CONF.paste_deploy['api_paste_config'])
+    if config_path is None:
+        return None
 
     return os.path.abspath(config_path)