コード例 #1
0
ファイル: report.py プロジェクト: TTMaZa/tern
def load_base_image():
    '''Create base image from dockerfile instructions and return the image'''
    base_image, dockerfile_lines = dhelper.get_dockerfile_base()
    # try to get image metadata
    if docker_api.dump_docker_image(base_image.repotag):
        # now see if we can load the image
        try:
            base_image.load_image()
        except (NameError, subprocess.CalledProcessError, IOError,
                docker.errors.APIError, ValueError, EOFError) as error:
            logger.warning('Error in loading base image: %s', str(error))
            base_image.origins.add_notice_to_origins(
                dockerfile_lines, Notice(str(error), 'error'))
    return base_image
コード例 #2
0
ファイル: report.py プロジェクト: xaleeks/tern
def load_base_image():
    '''Create base image from dockerfile instructions and return the image'''
    base_image, dockerfile_lines = dhelper.get_dockerfile_base()
    # try to get image metadata
    if container.check_image(base_image.repotag) is None:
        # if no base image is found, give a warning and continue
        if container.pull_image(base_image.repotag) is None:
            logger.warning(
                "%s",
                errors.cannot_find_image.format(imagetag=base_image.repotag))
    try:
        base_image.load_image()
    except (NameError, subprocess.CalledProcessError, IOError, ValueError,
            EOFError) as error:
        logger.warning('Error in loading base image: %s', str(error))
        base_image.origins.add_notice_to_origins(dockerfile_lines,
                                                 Notice(str(error), 'error'))
    return base_image