(cli, image)
return image_found
Validate image
Validate image
Validate image
def validate_image(cli, image):
    """Validate image"""

    try:
        image_found = api_utils.get_openstack_resource(cli.glance().images,
                                                       image, 'images')
    except (glance_exception.NotFound, exception.ResourceNotFound):
        raise exception.ImageNotFound(image_id=image)
    except glance_exception.HTTPForbidden:
        raise exception.ImageNotAuthorized(image_id=image)
    if not image_found.get('os_distro'):
        raise exception.OSDistroFieldNotFound(image_id=image)
    return image_found
def validate_image ( cli , image ) : try : image_found = api_utils . get_openstack_resource ( cli . glance ( ) . images , image , 'images' ) except ( glance_exception . NotFound , exception . ResourceNotFound ) : raise exception . ImageNotFound ( image_id = image ) except glance_exception . HTTPForbidden : raise exception . ImageNotAuthorized ( image_id = image ) if not image_found . get ( 'os_distro' ) : raise exception . OSDistroFieldNotFound ( image_id = image ) return image_found