Exemplo n.º 1
0
import tempfile
import requests
import json
import zipfile

from picli.actions import base
from picli import logger
from picli import util

LOG = logger.get_logger(__name__)


class Validator(base.Base):
    """Validation object to perform checks against a PiCli run.

    Creates a zip of the configuration files supplied by
    the base_config object provided during initialization. This config
    is written to a run_vars.yml file which is sent to an external validation
    function.
    We then parse the results of the validation. If the policy checks are
    set to enforcing then we will exit, if they are set to permissive then we
    will warn the user and continue with the execution.

    """
    def __init__(self, pipe_config):
        """
        Initialize the Validator.
        :param base_config: ValidatePipeConfig object
        """
        self.pipe_config = pipe_config
Exemplo n.º 2
0
import anyconfig
from typing import Dict
import re
import sys
import yaml

from picli.logger import get_logger

LOG = get_logger(__name__)


class SafeDumper(yaml.SafeDumper):
    def increase_indent(self, flow=False, indentless=False):
        return super(SafeDumper, self).increase_indent(flow, False)


def merge_dicts(a: Dict, b: Dict) -> Dict:
    """
    Merges the values of B into A and returns a mutated dict A.
    ::
        dict a
        b:
           - c: 0
           - c: 2
        d:
           e: "aaa"
           f: 3
        dict b
        a: 1
        b:
           - c: 3