summaryrefslogtreecommitdiff
path: root/openstackclient/shell.py
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient/shell.py')
-rw-r--r--openstackclient/shell.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/openstackclient/shell.py b/openstackclient/shell.py
index bd13fbb5..659bbee7 100644
--- a/openstackclient/shell.py
+++ b/openstackclient/shell.py
@@ -285,12 +285,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.
@@ -399,6 +404,9 @@ class OpenStackShell(app.App):
cmd.__class__.__name__,
)
if cmd.auth_required:
+ if hasattr(cmd, 'required_scope'):
+ # let the command decide whether we need a scoped token
+ self.client_manager.setup_auth(cmd.required_scope)
# Trigger the Identity client to initialize
self.client_manager.auth_ref
return