Fix the handling of non-existing paste file

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
This commit is contained in:
Angus Salkeld 2013-05-28 12:06:28 +10:00
parent 82f5fa098a
commit 38f4de9414
1 changed files with 4 additions and 2 deletions

View 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)