Exemplo n.º 1
0
def stub_runtime():
    rt = runtime.Runtime(
        latest_parent_version=False,
        logger=logutil.getLogger(__name__),
        stage=False,
        branch=None,
    )
    rt.group_config = model.Model()
    return rt
Exemplo n.º 2
0
from __future__ import print_function
from __future__ import unicode_literals
import glob
import json
import os
import re
import shutil
import threading
import yaml

from functools import wraps
from dockerfile_parse import DockerfileParser
from doozerlib import brew, exectools, logutil, pushd, util

logger = logutil.getLogger(__name__)


def log(func):
    """Logging decorator, log the call and return value of a decorated function

    :param function func: Function to be decorated
    :return: Return wrapper function
    """
    @wraps(func)
    def wrapper(*args, **kwargs):
        logger.info('running: {}, with args {} {}'.format(
            func.__name__, args, kwargs))
        return_val = func(*args, **kwargs)
        logger.info('{} returned {}'.format(func.__name__, return_val))
        return return_val
Exemplo n.º 3
0
import io
import os
from urllib.parse import urlparse

import requests
import yaml

from doozerlib.exceptions import DoozerFatalError
from doozerlib.exectools import cmd_assert
from doozerlib.logutil import getLogger
from doozerlib.model import Missing
from doozerlib.pushd import Dir
from doozerlib.util import is_in_directory, mkdirs

LOGGER = getLogger(__name__)


class SourceModifierFactory(object):
    """A factory class for creating source modifier objects."""
    MODIFICATIONS = {}

    @classmethod
    def supports(cls, action_name):
        """Test if specified modification action is supported"""
        return action_name in cls.MODIFICATIONS

    def create(self, *args, **kwargs):
        """Create a source modifier based on action.

        For example, create a source modifier for adding an out-of-tree file: