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
This commit is contained in:
Juan Antonio Osorio Robles 2015-04-27 08:39:21 +03:00
parent 416d840dc4
commit 48b52a0d40

@ -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):