Esempio n. 1
0
def image_id(ec2_conn, image, account):
    """Resolve CLI image arguments to image id."""
    if not image and metadata.image_id():
        image = {'ids': [metadata.image_id()]}
    if not account:
        account = 'self'
    return ec2client.get_image(ec2_conn, owners=[account], **image)['ImageId']
Esempio n. 2
0
def image_id(ec2_conn, sts_conn, image, account):
    """Resolve CLI image arguments to image id."""
    if not image and metadata.image_id():
        image = {'ids': [metadata.image_id()]}
    if not account:
        account = sts_conn.get_caller_identity().get('Account')
    return ec2client.get_image(ec2_conn, owners=[account], **image)['ImageId']
Esempio n. 3
0
    def configure(account, image):
        """Configure AMI image."""
        if not image:
            image = {'ids': [metadata.image_id()]}

        ec2_conn = awscontext.GLOBAL.ec2

        owners = []
        if not account:
            account = 'self'

        image_obj = ec2client.get_image(ec2_conn, owners=[account], **image)
        cli.out(formatter(image_obj))