예제 #1
0
def get_image_id(image):
    """Returns the image ID given either the ID itself or an image name."""
    if is_number(image):
        return image

    possible_images = api.images(filter_term=image)

    if len(possible_images) == 1:
        image = possible_images[0][0]
    else:
        cli_print_table(possible_images, 'image')
        image = click.prompt(
            '\nMultiple matches found. Please enter image ID', type=int)

    return image
예제 #2
0
def get_image_id(image):
    """Returns the image ID given either the ID itself or an image name."""
    if is_number(image):
        return image

    possible_images = api.images(filter_term=image)

    if len(possible_images) == 1:
        image = possible_images[0][0]
    else:
        cli_print_table(possible_images, 'image')
        image = click.prompt('\nMultiple matches found. Please enter image ID',
                             type=int)

    return image
예제 #3
0
파일: cli.py 프로젝트: rhefner1/vcl-client
def images(filter_term, refresh):
    """Lists all of the images available in VCL."""
    to_print = api.images(filter_term=filter_term, refresh=refresh)
    utils.cli_print_table(to_print, "image")
예제 #4
0
def images(filter_term, refresh):
    """Lists all of the images available in VCL."""
    to_print = api.images(filter_term=filter_term, refresh=refresh)
    utils.cli_print_table(to_print, 'image')