def safe_delete_from_backend(context, image_id, location):
 try:
  ret = store_api.delete_from_backend(location['url'], context=context)
  location['status'] = 'deleted'
  if ('id' in location):
   db_api.get_api().image_location_delete(context, image_id, location['id'], 'deleted')
  return ret
 except store_api.NotFound:
  msg = (_LW('Failed to delete image %s in store from URI') % image_id)
  LOG.warn(msg)
 except store_api.StoreDeleteNotSupported as e:
  LOG.warn(encodeutils.exception_to_unicode(e))
 except store_api.UnsupportedBackend:
  exc_type = sys.exc_info()[0].__name__
  msg = (_LE('Failed to delete image %(image_id)s from store: %(exc)s') % dict(image_id=image_id, exc=exc_type))
  LOG.error(msg)

def safe_delete_from_backend ( context , image_id , location ) : try : ret = store_api . delete_from_backend ( location [ 'url' ] , context = context ) location [ 'status' ] = 'deleted' if ( 'id' in location ) : db_api . get_api ( ) . image_location_delete ( context , image_id , location [ 'id' ] , 'deleted' ) return ret except store_api . NotFound : msg = ( _LW ( 'Failed to delete image %s in store from URI' ) % image_id ) LOG . warn ( msg ) except store_api . StoreDeleteNotSupported as e : LOG . warn ( encodeutils . exception_to_unicode ( e ) ) except store_api . UnsupportedBackend : exc_type = sys . exc_info ( ) [ 0 ] . __name__ msg = ( _LE ( 'Failed to delete image %(image_id)s from store: %(exc)s' ) % dict ( image_id = image_id , exc = exc_type ) ) LOG . error ( msg )
given a uri .