Example #1
0
    def __init__(self, anchore_config, imagelist, allimages, docker_cli=None):
        self.config = anchore_config
        self.allimages = allimages
        self.anchore_datadir = self.config['image_data_store']
        self.images = list()

        self.images = anchore_utils.image_context_add(imagelist, allimages, docker_cli=docker_cli, anchore_datadir=self.anchore_datadir, tmproot=self.config['tmpdir'], anchore_db=contexts['anchore_db'], must_be_analyzed=True, must_load_all=True)
Example #2
0
    def __init__(self, anchore_config, imagelist, allimages, force=False):
        self.config = anchore_config
        self.allimages = allimages
        self.force = force
        self.anchore_datadir = self.config['image_data_store']

        if len(imagelist) <= 0:
            raise Exception("No images given to evaluate")

        self.images = anchore_utils.image_context_add(
            imagelist,
            allimages,
            docker_cli=contexts['docker_cli'],
            anchore_datadir=self.anchore_datadir,
            tmproot=self.config['tmpdir'],
            anchore_db=contexts['anchore_db'],
            docker_images=contexts['docker_images'],
            must_be_analyzed=True,
            must_load_all=True)

        self.anchoreDB = contexts['anchore_db']

        self.default_gatepol = '/'.join(
            [self.config.config_dir, "anchore_gate.policy"])

        self.policy_override = None
Example #3
0
    def __init__(self, anchore_config, imagelist, allimages):
        self.config = anchore_config
        self.allimages = allimages
        self.anchore_datadir = self.config['image_data_store']
        self.images = list()

        self.images = anchore_utils.image_context_add(imagelist, allimages, docker_cli=contexts['docker_cli'], anchore_datadir=self.anchore_datadir, tmproot=self.config['tmpdir'], anchore_db=contexts['anchore_db'], docker_images=contexts['docker_images'], must_be_analyzed=True, must_load_all=True)
Example #4
0
    def __init__(self, anchore_config, imagelist, allimages, force, args=None):
        self._logger.debug("analyzer initialization: begin")

        self.config = anchore_config
        self.allimages = allimages
        self.force = force

        self.dockerfile = None
        try:
            self.dockerfile = args['dockerfile']
        except:
            pass

        self.skipgates = False
        try:
            self.skipgates = args['skipgates']
        except:
            pass

        #self.analyze_familytree = args.get('analyze_familytree', False) if args else False

        # Instantiate the appropriate strategy
        self.selection_strategy = strategies.get(
            args.get('selection_strategy',
                     'NoIntermediates'))() if args else FirstLastStrategy()

        try:
            if 'isbase' in args and args['isbase']:
                usertype = 'base'
            elif 'anchorebase' in args and args['anchorebase']:
                usertype = 'anchorebase'
            else:
                usertype = None
        except:
            usertype = None

        self._logger.debug("init input processed, loading input images: " +
                           str(imagelist))

        self.images = anchore_utils.image_context_add(
            imagelist,
            allimages,
            docker_cli=contexts['docker_cli'],
            dockerfile=self.dockerfile,
            tmproot=self.config['tmpdir'],
            anchore_db=contexts['anchore_db'],
            docker_images=contexts['docker_images'],
            usertype=usertype,
            must_load_all=True)

        self._logger.debug(
            "loaded input images, checking that all input images have been loaded "
            + str(self.images))

        self.anchoreDB = contexts['anchore_db']

        self._logger.debug("analyzer initialization: end")
Example #5
0
    def __init__(self,
                 anchore_config,
                 imagelist,
                 allimages,
                 force,
                 args=None,
                 docker_cli=None):
        self._logger.debug("analyzer initialization: begin")

        self.config = anchore_config
        self.allimages = allimages
        self.force = force
        self.anchore_datadir = self.config['image_data_store']

        self.dockerfile = None
        try:
            self.dockerfile = args['dockerfile']
        except:
            pass

        self.skipgates = False
        try:
            self.skipgates = args['skipgates']
        except:
            pass

        try:
            if 'isbase' in args and args['isbase']:
                usertype = 'base'
            elif 'anchorebase' in args and args['anchorebase']:
                usertype = 'anchorebase'
            else:
                usertype = None
        except:
            usertype = None

        self._logger.debug("init input processed, loading input images: " +
                           str(imagelist))

        self.images = anchore_utils.image_context_add(
            imagelist,
            allimages,
            docker_cli=docker_cli,
            dockerfile=self.dockerfile,
            anchore_datadir=self.anchore_datadir,
            tmproot=self.config['tmpdir'],
            anchore_db=contexts['anchore_db'],
            usertype=usertype,
            must_load_all=True)

        self._logger.debug(
            "loaded input images, checking that all input images have been loaded "
            + str(self.images))

        self.anchoreDB = contexts['anchore_db']

        self._logger.debug("analyzer initialization: end")
Example #6
0
    def add_images(self, imagelist):
        newimages = anchore_utils.image_context_add(
            imagelist,
            self.allimages,
            docker_cli=contexts['docker_cli'],
            tmproot=self.config['tmpdir'],
            anchore_db=contexts['anchore_db'],
            docker_images=contexts['docker_images'],
            must_be_analyzed=True,
            must_load_all=True)

        self.images = list(set(self.images) | set(newimages))
Example #7
0
    def __init__(self, anchore_config, imagelist, allimages, force=False):
        self.config = anchore_config
        self.allimages = allimages
        self.force = force        
        self.anchore_datadir = self.config['image_data_store']
        
        if len(imagelist) <= 0:
            raise Exception("No images given to evaluate")

        self.images = anchore_utils.image_context_add(imagelist, allimages, docker_cli=contexts['docker_cli'], anchore_datadir=self.anchore_datadir, tmproot=self.config['tmpdir'], anchore_db=contexts['anchore_db'], must_be_analyzed=True, must_load_all=True)

        self.anchoreDB = contexts['anchore_db']
Example #8
0
    def __init__(self, anchore_config, imagelist, allimages, force, args=None):
        self._logger.debug("analyzer initialization: begin")

        self.config = anchore_config
        self.allimages = allimages
        self.force = force

        self.dockerfile = None
        try:
            self.dockerfile = args['dockerfile']
        except:
            pass

        self.skipgates = False
        try:
            self.skipgates = args['skipgates']
        except:
            pass

        #self.analyze_familytree = args.get('analyze_familytree', False) if args else False

        # Instantiate the appropriate strategy
        self.selection_strategy = strategies.get(args.get('selection_strategy', 'NoIntermediates'))() if args else FirstLastStrategy()

        try:
            if 'isbase' in args and args['isbase']:
                usertype = 'base'
            elif 'anchorebase' in args and args['anchorebase']:
                usertype = 'anchorebase'
            else:
                usertype = None
        except:
            usertype = None

        self._logger.debug("init input processed, loading input images: " + str(imagelist))
        
        self.images = anchore_utils.image_context_add(imagelist, allimages, docker_cli=contexts['docker_cli'], dockerfile=self.dockerfile, tmproot=self.config['tmpdir'], anchore_db=contexts['anchore_db'], docker_images=contexts['docker_images'], usertype=usertype, must_load_all=True)

        self._logger.debug("loaded input images, checking that all input images have been loaded " + str(self.images))

        self.anchoreDB = contexts['anchore_db']

        self._logger.debug("analyzer initialization: end")
Example #9
0
    def __init__(self, anchore_config, imagelist, allimages, force=False):
        self.config = anchore_config
        self.allimages = allimages
        self.force = force
        self.anchore_datadir = self.config['image_data_store']

        if len(imagelist) <= 0:
            raise Exception("No images given to evaluate")

        self.images = anchore_utils.image_context_add(
            imagelist,
            allimages,
            docker_cli=contexts['docker_cli'],
            anchore_datadir=self.anchore_datadir,
            tmproot=self.config['tmpdir'],
            anchore_db=contexts['anchore_db'],
            must_be_analyzed=True,
            must_load_all=True)

        self.anchoreDB = contexts['anchore_db']
Example #10
0
    def __init__(self, anchore_config, imagelist, allimages, force, args=None):
        self._logger.debug("analyzer initialization: begin")

        self.config = anchore_config
        self.allimages = allimages
        self.force = force
        self.anchore_datadir = self.config['image_data_store']

        self.dockerfile = None
        try:
            self.dockerfile = args['dockerfile']
        except:
            pass

        self.skipgates = False
        try:
            self.skipgates = args['skipgates']
        except:
            pass

        try:
            if 'isbase' in args and args['isbase']:
                usertype = 'base'
            elif 'anchorebase' in args and args['anchorebase']:
                usertype = 'anchorebase'
            else:
                usertype = None
        except:
            usertype = None

        self._logger.debug("init input processed, loading input images: " + str(imagelist))
        
        self.images = anchore_utils.image_context_add(imagelist, allimages, docker_cli=contexts['docker_cli'], dockerfile=self.dockerfile, anchore_datadir=self.anchore_datadir, tmproot=self.config['tmpdir'], anchore_db=contexts['anchore_db'], usertype=usertype, must_load_all=True)

        self._logger.debug("loaded input images, checking that all input images have been loaded " + str(self.images))

        self.anchoreDB = contexts['anchore_db']

        self._logger.debug("analyzer initialization: end")
Example #11
0
    def add_images(self, imagelist):
        newimages = anchore_utils.image_context_add(imagelist, self.allimages, docker_cli=contexts['docker_cli'], anchore_datadir=self.anchore_datadir, tmproot=self.config['tmpdir'], anchore_db=contexts['anchore_db'], must_be_analyzed=True, must_load_all=True)

        self.images = list(set(self.images) | set(newimages))