How to use the cekit.config.Config function in cekit

To help you get started, we’ve selected a few cekit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cekit / cekit / tests / test_unit_generator_docker.py View on Github external
def cekit_config(redhat=False):
    config = Config()
    config.cfg.update({'common': {'redhat': redhat}})

    try:
        yield config
    finally:
        pass
github cekit / cekit / tests / test_integ_builder_osbs.py View on Github external
from cekit.cli import Cekit, Map, cli
from cekit.tools import Chdir
from cekit.config import Config
from cekit.errors import CekitError
from cekit.builders.osbs import OSBSBuilder
from cekit.tools import Map

config = Config()


@pytest.fixture(autouse=True)
def reset_config():
    config.cfg['common'] = {}


config = Config()
config.cfg['common'] = {'redhat': True}

image_descriptor = {
    'schema_version': 1,
    'from': 'centos:7',
    'name': 'test/image',
    'version': '1.0',
    'labels': [{'name': 'foo', 'value': 'bar'}, {'name': 'labela', 'value': 'a'}],
    'osbs': {
            'repository': {
                'name': 'repo',
                'branch': 'branch'
            }
    }
}
github cekit / cekit / cekit / descriptor / resource.py View on Github external
try:
    from urllib.parse import urlparse
    from urllib.request import urlopen
except ImportError:
    from urlparse import urlparse
    from urllib2 import urlopen

from cekit.config import Config
from cekit.crypto import SUPPORTED_HASH_ALGORITHMS, check_sum
from cekit.descriptor import Descriptor
from cekit.errors import CekitError
from cekit.tools import get_brew_url, Map

logger = logging.getLogger('cekit')
config = Config()


def create_resource(descriptor, **kwargs):
    """
    Module method responsible for instantiating proper resource object
    based on the provided descriptor.

    In most cases, only descriptor is required to create the object from descriptor.
    In case additional data is required, the kwargs 'dictionary' will be checked
    if the required key exists and will be used in the object constructor.
    """

    if 'image' in descriptor:
        return _ImageContentResource(descriptor)

    if 'path' in descriptor:
github cekit / cekit / cekit / builder.py View on Github external
import logging

from cekit.config import Config
from cekit.errors import CekitError
from cekit.tools import DependencyHandler

LOGGER = logging.getLogger('cekit')
CONFIG = Config()


class Command(object):
    TYPE_BUILDER = 'builder'
    TYPE_TESTER = 'tester'

    def __init__(self, command, command_type):
        self._command = command
        self._type = command_type

        # Initialize dependency handler
        self.dependency_handler = DependencyHandler()

        LOGGER.debug("Checking CEKit core dependencies...")
        self.dependency_handler.handle_core_dependencies()
github cekit / cekit / cekit / descriptor / packages.py View on Github external
import logging
import os

import yaml

from cekit.config import Config
from cekit.descriptor import Descriptor
from cekit.descriptor.resource import create_resource
from cekit.errors import CekitError

logger = logging.getLogger('cekit')
config = Config()

packages_schema = yaml.safe_load("""
map:
  content_sets: {type: any}
  content_sets_file: {type: str}
  repositories:
    seq:
      - {type: any}
  install:
    seq:
      - {type: any}
  manager: {type: str, enum: ['yum', 'dnf', 'microdnf']}""")


repository_schema = yaml.safe_load("""
map:
github cekit / cekit / cekit / builders / osbs.py View on Github external
import yaml

try:
    from urllib.parse import urlparse
except ImportError:
    from urlparse import urlparse

from cekit import tools
from cekit.config import Config
from cekit.builder import Builder
from cekit.descriptor.resource import _PlainResource
from cekit.errors import CekitError
from cekit.tools import Chdir, copy_recursively

LOGGER = logging.getLogger('cekit')
CONFIG = Config()


class OSBSBuilder(Builder):
    """Class representing OSBS builder."""

    def __init__(self, params):
        super(OSBSBuilder, self).__init__('osbs', params)

        self._rhpkg_set_url_repos = []
        self.dist_git = None
        self.dist_git_dir = None
        self.artifacts = []

        if CONFIG.get('common', 'redhat'):
            if self.params.get('stage'):
                self._fedpkg = '/usr/bin/rhpkg-stage'