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
This commit is contained in:
Hideki Saito 2016-02-14 14:06:49 +09:00
parent 73cabcc871
commit e5b8e08eb1

View File

@ -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.