Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 893041

Summary: glance client does not catch gracefully a keyboard interrupt (ctrl-c)
Product: Red Hat OpenStack Reporter: Yaniv Kaul <ykaul>
Component: python-glanceclientAssignee: John Bresnahan <jbresnah>
Status: CLOSED ERRATA QA Contact: Attila Fazekas <afazekas>
Severity: low Docs Contact:
Priority: low    
Version: 2.0 (Folsom)CC: abaron, apevec, breeler, eglynn, jbresnah, jkt
Target Milestone: rcKeywords: Triaged
Target Release: 2.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-glanceclient-0.8.0-4.el6ost Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 918770 918774 (view as bug list) Environment:
Last Closed: 2013-04-08 23:43:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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