Bug 893041 - glance client does not catch gracefully a keyboard interrupt (ctrl-c)
Summary: glance client does not catch gracefully a keyboard interrupt (ctrl-c)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: python-glanceclient
Version: 2.0 (Folsom)
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: 2.1
Assignee: John Bresnahan
QA Contact: Attila Fazekas
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-01-08 13:59 UTC by Yaniv Kaul
Modified: 2016-04-26 20:29 UTC (History)
6 users (show)

Fixed In Version: python-glanceclient-0.8.0-4.el6ost
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 918770 918774 (view as bug list)
Environment:
Last Closed: 2013-04-08 23:43:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenStack gerrit 22359 0 None None None Never
Red Hat Product Errata RHBA-2013:0715 0 normal SHIPPED_LIVE python-glanceclient bug fix advisory 2013-04-15 18:39:27 UTC

Description Yaniv Kaul 2013-01-08 13:59:19 UTC
Description of problem:
When interrupting a download, I expect not to get a traceback:
[root@ykaul-os-horizon ~(keystone_admin)]$ glance image-download  --file /tmp/rhel64-min-b.qcow2 b5379980-341a-454c-a811-5783ab5b9d52 
^C^C^CTraceback (most recent call last):
  File "/usr/bin/glance", line 9, in <module>
    load_entry_point('python-glanceclient==0.5.1', 'console_scripts', 'glance')()
  File "/usr/lib/python2.6/site-packages/glanceclient/shell.py", line 432, in main
    OpenStackImagesShell().main(sys.argv[1:])
  File "/usr/lib/python2.6/site-packages/glanceclient/shell.py", line 403, in main
    args.func(client, args)
  File "/usr/lib/python2.6/site-packages/glanceclient/v1/shell.py", line 88, in do_image_download
    utils.save_image(body, args.file)
  File "/usr/lib/python2.6/site-packages/glanceclient/common/utils.py", line 150, in save_image
    image.write(chunk)
KeyboardInterrupt


Version-Release number of selected component (if applicable):
python-glanceclient-0.5.1-1.el6.noarch

How reproducible:


Steps to Reproduce:
1. Begin download of an image
2. Break (ctrl-c) in the middle.
3.
  
Actual results:


Expected results:


Additional info:

Comment 2 Eoghan Glynn 2013-01-14 15:44:39 UTC
OK, so this could be made a bit more graceful by catching KeyboardInterrupt so as to avoid the unsightly traceback.

However, generally an image download is redirected via stdout to a file. Since this file is under the control of the parent shell, i.e. unknown to the glance CLI, this partial file cannot be cleaned up on interrupt.

Comment 3 John Bresnahan 2013-02-19 21:51:36 UTC
I created the upstream bug here:

https://bugs.launchpad.net/python-glanceclient/+bug/1130390

Comment 4 John Bresnahan 2013-02-19 22:05:55 UTC
An upstream patch is here: https://review.openstack.org/#/c/22359/

Comment 21 Bruce Reeler 2013-04-06 07:37:57 UTC
Just restating for public viewing that the original fix (Comments 3&4) was moved to earlier in the code, to catch Ctrl-C sooner, by John Bresnahan, and he submitted a new upstream bug and patch:

> John Bresnahan:

> I submitted this bug upstream:

> https://bugs.launchpad.net/python-glanceclient/+bug/1157905

> and this patch:

> https://review.openstack.org/#/c/24923/

Comment 23 errata-xmlrpc 2013-04-08 23:43:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0715.html


Note You need to log in before you can comment on or make changes to this bug.