diff options
| author | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2016-03-09 23:19:22 +0100 |
|---|---|---|
| committer | Danny Al-Gaaf <danny.al-gaaf@bisect.de> | 2016-03-09 23:27:02 +0100 |
| commit | 860908c51791da9655d09fd176a1e7fcec6881b8 (patch) | |
| tree | 05a198ea5236c4501186c4472aca1daa7dcc0e92 /glanceclient/v2/shell.py | |
| parent | 22a03fd475d1807dee41b24291862f1bdc361273 (diff) | |
| download | python-glanceclient-860908c51791da9655d09fd176a1e7fcec6881b8.tar.gz | |
Catch InUseByStore case in do_image_delete
In case do_image_delete() is called on an image that is
in use and can't be deleted by the driver a HTTPConflict
error is raised in glance. Catch this error and print a
propper error message.
Closes-Bug: #1551037
Change-Id: Id17098f27511df8e05e56b8df21e748921223bd9
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Diffstat (limited to 'glanceclient/v2/shell.py')
| -rw-r--r-- | glanceclient/v2/shell.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/glanceclient/v2/shell.py b/glanceclient/v2/shell.py index eaae374..5f0728e 100644 --- a/glanceclient/v2/shell.py +++ b/glanceclient/v2/shell.py @@ -338,6 +338,10 @@ def do_image_delete(gc, args): msg = "No image with an ID of '%s' exists." % args_id utils.print_err(msg) failure_flag = True + except exc.HTTPConflict: + msg = "Unable to delete image '%s' because it is in use." % args_id + utils.print_err(msg) + failure_flag = True except exc.HTTPException as e: msg = "'%s': Unable to delete image '%s'" % (e, args_id) utils.print_err(msg) |
