How to use the cekit.descriptor.Overrides 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_image.py View on Github external
with mocker.mock_module.patch('cekit.descriptor.packages.open', mocker.mock_open(read_data='{"arch": ["a", "b"]}')):
            image = Image(yaml.safe_load("""
                from: foo
                name: test/foo
                version: 1.9
                packages:
                    install:
                        - abc
                         def
                    content_sets_file: cs.yaml
                """), 'foo')

    assert image.packages.content_sets == {'arch': ['a', 'b']}
    assert 'content_sets_file' not in image.packages

    image.apply_image_overrides([Overrides({'packages': {'content_sets_file': None}}, "a/path")])

    assert 'content_sets' not in image.packages
    assert 'content_sets_file' not in image.packages
github cekit / cekit / tests / test_unit_tools.py View on Github external
def test_merging_description_override():
    desc1 = Image({'name': 'foo', 'version': 1}, None)

    desc2 = Overrides({'name': 'mod1',
                       'description': 'mod_desc'}, None)

    merged = _merge_descriptors(desc2, desc1)
    assert 'description' in merged
github cekit / cekit / tests / test_unit_resource.py View on Github external
def test_overide_resource_remove_chksum():
    image = Image(yaml.safe_load("""
    from: foo
    name: test/foo
    version: 1.9
    artifacts:
      - name: abs
        path: /tmp/abs
        md5: 'foo'
        sha1: 'foo'
        sha256: 'foo'
        sha512: 'foo'
    """), 'foo')
    overrides = Overrides(yaml.safe_load("""
    artifacts:
      - name: abs
        path: /tmp/over
"""), 'foo')
    overrides.merge(image)

    assert overrides['from'] == 'foo'
    assert overrides['artifacts'][0]['path'] == '/tmp/over'
    assert 'md5' not in overrides['artifacts'][0]
    assert 'sha1' not in overrides['artifacts'][0]
    assert 'sha256' not in overrides['artifacts'][0]
    assert 'sha512' not in overrides['artifacts'][0]
github cekit / cekit / tests / test_unit_image.py View on Github external
name: test/foo
    version: 1.9
    packages:
      install:
        - abc
        - def
      content_sets:
        arch:
          - namea
          - nameb
    """), 'foo')

    assert image.packages.content_sets == {'arch': ['namea', 'nameb']}
    assert 'content_sets_file' not in image.packages

    image.apply_image_overrides([Overrides({'packages': {'content_sets': None}}, "a/path")])

    assert 'content_sets' not in image.packages
    assert 'content_sets_file' not in image.packages
github cekit / cekit / cekit / generator / base.py View on Github external
def get_tech_preview_overrides(self):
        class TechPreviewOverrides(Overrides):
            def __init__(self, image):
                super(TechPreviewOverrides, self).__init__({}, None)
                self._image = image

            @property
            def name(self):
                new_name = self._image.name
                if '/' in new_name:
                    family, new_name = new_name.split('/')
                    new_name = "%s-tech-preview/%s" % (family, new_name)
                else:
                    new_name = "%s-tech-preview" % new_name
                return new_name

        return TechPreviewOverrides(self.image)
github cekit / cekit / cekit / generator / base.py View on Github external
def get_redhat_overrides(self):
        class RedHatOverrides(Overrides):
            def __init__(self, generator):
                super(RedHatOverrides, self).__init__({}, None)
                self._generator = generator

            @property
            def envs(self):
                return [
                    Env({'name': 'JBOSS_IMAGE_NAME',
                         'value': '%s' % self._generator.image['name']}),
                    Env({'name': 'JBOSS_IMAGE_VERSION',
                         'value': '%s' % self._generator.image['version']})
                ]

            @property
            def labels(self):
                labels = [
github cekit / cekit / cekit / generator / base.py View on Github external
def get_redhat_overrides(self):
        class RedHatOverrides(Overrides):
            def __init__(self, generator):
                super(RedHatOverrides, self).__init__({}, None)
                self._generator = generator

            @property
            def envs(self):
                return [
                    Env({'name': 'JBOSS_IMAGE_NAME',
                         'value': '%s' % self._generator.image['name']}),
                    Env({'name': 'JBOSS_IMAGE_VERSION',
                         'value': '%s' % self._generator.image['version']})
                ]

            @property
            def labels(self):
                labels = [