def _find_image(name):
 try:
  images = __salt__['glance.image_list'](name=name)
 except kstone_Unauthorized:
  return (False, 'keystoneclient: Unauthorized')
 except glance_Unauthorized:
  return (False, 'glanceclient: Unauthorized')
 log.debug('Got images: {0}'.format(images))
 if ((type(images) is dict) and (len(images) == 1) and ('images' in images)):
  images = images['images']
 images_list = (images.values() if (type(images) is dict) else images)
 if (len(images_list) == 0):
  return (None, 'No image with name "{0}"'.format(name))
 elif (len(images_list) == 1):
  return (images_list[0], 'Found image {0}'.format(name))
 elif (len(images_list) > 1):
  return (False, 'Found more than one image with given name')
 else:
  raise NotImplementedError

def _find_image ( name ) : try : images = __salt__ [ 'glance.image_list' ] ( name = name ) except kstone_Unauthorized : return ( False , 'keystoneclient: Unauthorized' ) except glance_Unauthorized : return ( False , 'glanceclient: Unauthorized' ) log . debug ( 'Got images: {0}' . format ( images ) ) if ( ( type ( images ) is dict ) and ( len ( images ) == 1 ) and ( 'images' in images ) ) : images = images [ 'images' ] images_list = ( images . values ( ) if ( type ( images ) is dict ) else images ) if ( len ( images_list ) == 0 ) : return ( None , 'No image with name "{0}"' . format ( name ) ) elif ( len ( images_list ) == 1 ) : return ( images_list [ 0 ] , 'Found image {0}' . format ( name ) ) elif ( len ( images_list ) > 1 ) : return ( False , 'Found more than one image with given name' ) else : raise NotImplementedError
get an image by name or id .