Skip to content

Commit 8939d26

Browse files
author
Doug Hellmann
committed
fix authentication setup in interactive mode and improve error handling so tracebacks are not printed twice
Change-Id: I59fb07369edad3b2f2abddba3c0d0f6bbce1eab1
1 parent fa4a4a3 commit 8939d26

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
@@ -196,9 +196,11 @@ def initialize_app(self, argv):
196196

197197
# If the user is not asking for help, make sure they
198198
# have given us auth.
199-
cmd_info = self.command_manager.find_command(argv)
200-
cmd_factory, cmd_name, sub_argv = cmd_info
201-
if cmd_name != 'help':
199+
cmd_name = None
200+
if argv:
201+
cmd_info = self.command_manager.find_command(argv)
202+
cmd_factory, cmd_name, sub_argv = cmd_info
203+
if self.interactive_mode or cmd_name != 'help':
202204
self.authenticate_user()
203205

204206
def prepare_to_run_command(self, cmd):
@@ -215,7 +217,10 @@ def clean_up(self, cmd, result, err):
215217

216218

217219
def main(argv=sys.argv[1:]):
218-
return OpenStackShell().run(argv)
220+
try:
221+
return OpenStackShell().run(argv)
222+
except:
223+
return 1
219224

220225

221226
if __name__ == "__main__":

0 commit comments

Comments
 (0)