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>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user