def rax_find_image(module, rax_module, image, exit=True):
 cs = rax_module.cloudservers
 try:
  UUID(image)
 except ValueError:
  try:
   image = cs.images.find(human_id=image)
  except (cs.exceptions.NotFound, cs.exceptions.NoUniqueMatch):
   try:
    image = cs.images.find(name=image)
   except (cs.exceptions.NotFound, cs.exceptions.NoUniqueMatch):
    if exit:
     module.fail_json(msg=('No matching image found (%s)' % image))
    else:
     return False
 return rax_module.utils.get_id(image)

def rax_find_image ( module , rax_module , image , exit = True ) : cs = rax_module . cloudservers try : UUID ( image ) except ValueError : try : image = cs . images . find ( human_id = image ) except ( cs . exceptions . NotFound , cs . exceptions . NoUniqueMatch ) : try : image = cs . images . find ( name = image ) except ( cs . exceptions . NotFound , cs . exceptions . NoUniqueMatch ) : if exit : module . fail_json ( msg = ( 'No matching image found (%s)' % image ) ) else : return False return rax_module . utils . get_id ( image )
find a server image by id or name .