def setup_logging(cls):
     init_test_logging()
     cls.log = logs.get_logger()
Exemple #2
0
import enum
from anchore_engine.services.policy_engine.engine.policy.gate import BaseTrigger, Gate, LifecycleStates
from anchore_engine.services.policy_engine.engine.policy.params import NameVersionStringListParameter, \
    CommaDelimitedStringListParameter
from anchore_engine.db import ImagePackage, ImagePackageManifestEntry
from anchore_engine.services.policy_engine.engine.util.packages import compare_package_versions
from anchore_engine.services.policy_engine.engine.logs import get_logger

log = get_logger()


class VerifyTrigger(BaseTrigger):
    __lifecycle_state__ = LifecycleStates.deprecated
    __trigger_name__ = 'verify'
    __description__ = 'Check package integrity against package db in in the image. Triggers for changes or removal or content in all or the selected DIRS param if provided, and can filter type of check with the CHECK_ONLY param'

    pkgs = CommaDelimitedStringListParameter(
        name='pkgs',
        description='List of package names to verify',
        example_str='libssl,openssl,curl',
        is_required=False)
    directories = CommaDelimitedStringListParameter(
        name='dirs',
        description=
        'List of directories to limit checks to so as to avoid checks on all dir',
        example_str='/usr/share,/usr,/var',
        is_required=False)
    check_only = CommaDelimitedStringListParameter(
        name='check_only',
        description='List of types of checks to perform instead of all',
        example_str='changed',
Exemple #3
0
import json
import enum
import os
import datetime
import shutil
import typing

from anchore_engine.utils import mapped_parser_item_iterator
from anchore_engine.services.policy_engine.engine.feeds import IFeedSource
from anchore_engine.services.policy_engine.engine.feeds.schemas import LocalFeedDataRepoMetadata, DownloadOperationConfiguration, DownloadOperationResult, GroupDownloadOperationConfiguration, FeedAPIGroupRecord, FeedAPIRecord, GroupDownloadResult

from anchore_engine.services.policy_engine.engine.logs import get_logger
logger = get_logger()

from anchore_engine.utils import ensure_bytes, timer

FEED_DATA_ITEMS_PATH = 'data.item'


class LocalFeedDataRepo(object):
    """
    A local-host structure holding feed data as well as a metadata store that can be read from or written-to like a feed
    """
    @classmethod
    def from_disk(cls, path):
        """
        Create a new repo instance from an existing one on disk, loading metadata
        :param path:
        :return:
        """
        r = LocalFeedDataRepo(metadata=LocalFeedDataRepoMetadata(