Ejemplo n.º 1
0
def create_ipaconfig(args):
    logger.info("Loading configuration")
    try:
        # CLI overrides have the highest priority
        overrides = [config.deepen_mapping(args.cli_overrides)]

        # overrides from CLI-specified config are next
        if args.config is not None:
            logger.info("Parsing configuration file %s", args.config)
            overrides.append(load_config_file(args.config))

        return config.IPADockerConfig(*overrides)
    except ValueError as e:
        logger.error("Failed to read configuration: %s", e)
        sys.exit(1)
def ipacontainer(docker_client):
    """
    Instantiate the container. This should pull the image from registry and
    create container. Stop and remove the container at the end.
    """
    docker_config = config.IPADockerConfig()
    docker_container = container.IPAContainer(docker_client, docker_config)

    try:
        yield docker_container
    finally:
        try:
            docker_container.stop_and_remove()
        except Exception:
            pass
Ejemplo n.º 3
0
def test_config_overrides():
    overrides = {
        'git_repo': 'custom/repo',
        'container': {
            'image': 'custom-image'
        },
        'host': {
            'tmpfs': ['/var/tmp']
        },
        'server': {
            'domain': 'example.org'
        }
    }

    test_config = config.IPADockerConfig(overrides)

    for key, value in overrides.items():
        if isinstance(value, dict):
            for key2, value2 in overrides[key].items():
                assert test_config[key][key2] == value2
        else:
            assert test_config[key] == value
Ejemplo n.º 4
0
def ipaconfig(request):
    """
    Default config
    """
    return config.IPADockerConfig()
Ejemplo n.º 5
0
def ipaconfig():
    """
    flattened default IPA config
    """
    return config.IPADockerConfig()