summaryrefslogtreecommitdiff
path: root/openstackclient/shell.py
diff options
context:
space:
mode:
authorDoug Hellmann <doug.hellmann@dreamhost.com>2012-05-14 10:50:25 -0400
committerDoug Hellmann <doug.hellmann@dreamhost.com>2012-05-14 10:50:57 -0400
commit8939d26a5bb055b7b818463ce3894d85ecc532eb (patch)
tree60ed9e3cbbc2832079be536f960c9692bcfb9efb /openstackclient/shell.py
parentfa4a4a37d6ce931a9832677dea1edffd228300a4 (diff)
downloadpython-openstackclient-8939d26a5bb055b7b818463ce3894d85ecc532eb.tar.gz
fix authentication setup in interactive mode and improve error handling so tracebacks are not printed twice
Change-Id: I59fb07369edad3b2f2abddba3c0d0f6bbce1eab1
Diffstat (limited to 'openstackclient/shell.py')
-rw-r--r--openstackclient/shell.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/openstackclient/shell.py b/openstackclient/shell.py
index c6242220..3f20d0a9 100644
--- a/openstackclient/shell.py
+++ b/openstackclient/shell.py
@@ -196,9 +196,11 @@ class OpenStackShell(App):
# If the user is not asking for help, make sure they
# have given us auth.
- cmd_info = self.command_manager.find_command(argv)
- cmd_factory, cmd_name, sub_argv = cmd_info
- if cmd_name != 'help':
+ cmd_name = None
+ if argv:
+ cmd_info = self.command_manager.find_command(argv)
+ cmd_factory, cmd_name, sub_argv = cmd_info
+ if self.interactive_mode or cmd_name != 'help':
self.authenticate_user()
def prepare_to_run_command(self, cmd):
@@ -215,7 +217,10 @@ class OpenStackShell(App):
def main(argv=sys.argv[1:]):
- return OpenStackShell().run(argv)
+ try:
+ return OpenStackShell().run(argv)
+ except:
+ return 1
if __name__ == "__main__":