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
This commit is contained in:
John Bresnahan 2013-03-20 08:51:59 -10:00
parent c7c8e92e3c
commit edf9ae5097

@ -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='<subcommand>', nargs='?',
help='Display help for <subcommand>')
@ -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)