diff options
author | Abhishek Talwar <abhishek.talwar@tcs.com> | 2014-12-11 14:54:03 +0530 |
---|---|---|
committer | Kamil Rykowski <kamil.rykowski@intel.com> | 2015-02-17 11:27:24 +0100 |
commit | f7cdc3eefe1d34bca2efb08d21c401cc9d9a457d (patch) | |
tree | 329b292e238b8e78c7609bc4e4f42ec96e916e2e /glanceclient/v1/shell.py | |
parent | 9829d7b6b9f2232bda8039b6db54be1d8885e7a0 (diff) | |
download | python-glanceclient-f7cdc3eefe1d34bca2efb08d21c401cc9d9a457d.tar.gz |
Glance image delete output
Deleting an already deleted image using admin user is throwing an
error "404 Not Found" which is confusing. Deleting an image that does
not exist throws "No image with a name or ID of 'image-id' exists."
Updated the code so that trying to delete an already deleted image
throws "No image with an ID of 'image-id' exists." error.
Closes-Bug: #1333119
Change-Id: I8f9a6174663337a0f48aafa029a4339c32eb2134
Co-Authored-By: Abhishek Talwar <abhishek.talwar@tcs.com>
Co-Authored-By: Kamil Rykowski <kamil.rykowski@intel.com>
Diffstat (limited to 'glanceclient/v1/shell.py')
-rw-r--r-- | glanceclient/v1/shell.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/glanceclient/v1/shell.py b/glanceclient/v1/shell.py index d4d117e..3a1bc81 100644 --- a/glanceclient/v1/shell.py +++ b/glanceclient/v1/shell.py @@ -321,6 +321,9 @@ def do_image_delete(gc, args): """Delete specified image(s).""" for args_image in args.images: image = utils.find_resource(gc.images, args_image) + if image and image.status == "deleted": + msg = "No image with an ID of '%s' exists." % image.id + raise exc.CommandError(msg) try: if args.verbose: print('Requesting image delete for %s ...' % |