From edf9ae509763a70c7cd72e79c8c3896b903981e3 Mon Sep 17 00:00:00 2001 From: John Bresnahan Date: Wed, 20 Mar 2013 08:51:59 -1000 Subject: [PATCH] Trapping KeyboardInterrupt sooner. Currently a KeyboardInterrupt can be triggered by the user while the client is communicating with keystone. This patch moves the trap higher up in the stack. Fixes bug: 1157905 Change-Id: I16889c2d97bc4694ab27c863c62c27333e264b60 --- glanceclient/shell.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glanceclient/shell.py b/glanceclient/shell.py index 8a54f14..5dc3687 100644 --- a/glanceclient/shell.py +++ b/glanceclient/shell.py @@ -440,9 +440,6 @@ class OpenStackImagesShell(object): args.func(client, args) except exc.Unauthorized: raise exc.CommandError("Invalid OpenStack Identity credentials.") - except KeyboardInterrupt: - LOG.warn('... terminating glance client') - sys.exit(1) @utils.arg('command', metavar='', nargs='?', help='Display help for ') @@ -470,6 +467,9 @@ class HelpFormatter(argparse.HelpFormatter): def main(): try: OpenStackImagesShell().main(map(utils.ensure_unicode, sys.argv[1:])) + except KeyboardInterrupt: + print >> sys.stderr, '... terminating glance client' + sys.exit(1) except Exception, e: print >> sys.stderr, e sys.exit(1)