summaryrefslogtreecommitdiff
path: root/openstackclient/shell.py
diff options
context:
space:
mode:
authorHideki Saito <saito@fgrep.org>2016-02-14 14:06:49 +0900
committerHideki Saito <saito@fgrep.org>2016-02-14 22:08:01 +0900
commite5b8e08eb1322447940ced48b492fdc1e87399b2 (patch)
treec1b88eaa72f8179dd22564c394e2bb97380a484e /openstackclient/shell.py
parent73cabcc871d0bc0dc98bb0499c75a4258ee86b10 (diff)
downloadpython-openstackclient-e5b8e08eb1322447940ced48b492fdc1e87399b2.tar.gz
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
Diffstat (limited to 'openstackclient/shell.py')
-rw-r--r--openstackclient/shell.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/openstackclient/shell.py b/openstackclient/shell.py
index c84e2b1d..137446ef 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.