From e5b8e08eb1322447940ced48b492fdc1e87399b2 Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Sun, 14 Feb 2016 14:06:49 +0900 Subject: [PATCH] Fix 'openstack --help' fails if clouds.yaml cannot be read 'openstack --help' can display the basic information, even if openstack command does not have permission to read clouds.yaml. Change-Id: I7d5255c5ce3bd60af77fc70f433ca78dc011a79f Closes-Bug: #1541047 --- openstackclient/shell.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/openstackclient/shell.py b/openstackclient/shell.py index c84e2b1d40..137446efb6 100644 --- a/openstackclient/shell.py +++ b/openstackclient/shell.py @@ -234,12 +234,17 @@ class OpenStackShell(app.App): # Do configuration file handling # Ignore the default value of interface. Only if it is set later # will it be used. - cc = cloud_config.OpenStackConfig( - override_defaults={ - 'interface': None, - 'auth_type': auth_type, + try: + cc = cloud_config.OpenStackConfig( + override_defaults={ + 'interface': None, + 'auth_type': auth_type, }, ) + except (IOError, OSError) as e: + self.log.critical("Could not read clouds.yaml configuration file") + self.print_help_if_requested() + raise e # TODO(thowe): Change cliff so the default value for debug # can be set to None.