Skip to content

Commit e5b8e08

Browse files
committed
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
1 parent 73cabcc commit e5b8e08

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

openstackclient/shell.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,17 @@ def initialize_app(self, argv):
234234
# Do configuration file handling
235235
# Ignore the default value of interface. Only if it is set later
236236
# will it be used.
237-
cc = cloud_config.OpenStackConfig(
238-
override_defaults={
239-
'interface': None,
240-
'auth_type': auth_type,
237+
try:
238+
cc = cloud_config.OpenStackConfig(
239+
override_defaults={
240+
'interface': None,
241+
'auth_type': auth_type,
241242
},
242243
)
244+
except (IOError, OSError) as e:
245+
self.log.critical("Could not read clouds.yaml configuration file")
246+
self.print_help_if_requested()
247+
raise e
243248

244249
# TODO(thowe): Change cliff so the default value for debug
245250
# can be set to None.

0 commit comments

Comments
 (0)