From 48b52a0d40013d65e85ebeadcfb80a06c431b6db Mon Sep 17 00:00:00 2001
From: Juan Antonio Osorio Robles <juan.osorio.robles@ericsson.com>
Date: Mon, 27 Apr 2015 08:39:21 +0300
Subject: [PATCH] Raise exception if no session is created

If the clientmanager is unable to create a keystone session (due to
insufficient auth parameters or something else) then the exception
caused by this shouldn't be ignored, as was the case.

On the other hand, we don't want this behaviour in the case of the
'complete' command, so this is now properly detected.

Change-Id: If4f453d23cc87900cda752e9ffbcf41ded59e26f
Closes-Bug: #1444640
---
 openstackclient/shell.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/openstackclient/shell.py b/openstackclient/shell.py
index 00f4a3c96f..90a6f32b70 100644
--- a/openstackclient/shell.py
+++ b/openstackclient/shell.py
@@ -24,6 +24,7 @@ import warnings
 
 from cliff import app
 from cliff import command
+from cliff import complete
 from cliff import help
 
 import openstackclient
@@ -76,6 +77,7 @@ class OpenStackShell(app.App):
 
         # Some commands do not need authentication
         help.HelpCommand.auth_required = False
+        complete.CompleteCommand.auth_required = False
 
         super(OpenStackShell, self).__init__(
             description=__doc__.strip(),
@@ -318,12 +320,8 @@ class OpenStackShell(app.App):
             cmd.__class__.__name__,
         )
         if cmd.auth_required:
-            try:
-                # Trigger the Identity client to initialize
-                self.client_manager.auth_ref
-            except Exception as e:
-                self.log.warning("Possible error authenticating: " + str(e))
-                pass
+            # Trigger the Identity client to initialize
+            self.client_manager.auth_ref
         return
 
     def clean_up(self, cmd, result, err):