Пример #1
0
def do_image_delete(gc, args):
    """Delete specified image."""
    failure_flag = False
    for args_id in args.id:
        try:
            gc.images.delete(args_id)
        except exc.HTTPForbidden:
            msg = "You are not permitted to delete the image '%s'." % args_id
            utils.print_err(msg)
            failure_flag = True
        except exc.HTTPNotFound:
            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)
            failure_flag = True
    if failure_flag:
        utils.exit()
Пример #2
0
def do_image_delete(gc, args):
    """Delete specified image."""
    failure_flag = False
    for args_id in args.id:
        try:
            gc.images.delete(args_id)
        except exc.HTTPForbidden:
            msg = "You are not permitted to delete the image '%s'." % args_id
            utils.print_err(msg)
            failure_flag = True
        except exc.HTTPNotFound:
            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)
            failure_flag = True
    if failure_flag:
        utils.exit()