def image_delete(id=None, name=None, profile=None):
 g_client = _auth(profile)
 image = {'id': False, 'name': None}
 if name:
  for image in g_client.images.list():
   if (image.name == name):
    id = image.id
    continue
 if (not id):
  return {'result': False, 'comment': 'Unable to resolve image id for name {0}'.format(name)}
 elif (not name):
  name = image['name']
 try:
  g_client.images.delete(id)
 except exc.HTTPNotFound:
  return {'result': False, 'comment': 'No image with ID {0}'.format(id)}
 except exc.HTTPForbidden as forbidden:
  log.error(str(forbidden))
  return {'result': False, 'comment': str(forbidden)}
 return {'result': True, 'comment': "Deleted image '{0}' ({1}).".format(name, id)}

def image_delete ( id = None , name = None , profile = None ) : g_client = _auth ( profile ) image = { 'id' : False , 'name' : None } if name : for image in g_client . images . list ( ) : if ( image . name == name ) : id = image . id continue if ( not id ) : return { 'result' : False , 'comment' : 'Unable to resolve image id for name {0}' . format ( name ) } elif ( not name ) : name = image [ 'name' ] try : g_client . images . delete ( id ) except exc . HTTPNotFound : return { 'result' : False , 'comment' : 'No image with ID {0}' . format ( id ) } except exc . HTTPForbidden as forbidden : log . error ( str ( forbidden ) ) return { 'result' : False , 'comment' : str ( forbidden ) } return { 'result' : True , 'comment' : "Deleted image '{0}' ({1})." . format ( name , id ) }
delete an image cli examples: .