Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve removal of elements in descriptors #460

Open
goldmann opened this issue Mar 27, 2019 · 0 comments

Comments

@goldmann
Copy link
Contributor

commented Mar 27, 2019

We can remove elements by specifying their value to null. In case the element has a schema value required set to True, removal will not work:

2019-03-27 16:10:36,198 cekit        DEBUG    Loading override '{"labels": [{"name": "usage", "value": "aaa"}]}'
2019-03-27 16:10:36,198 cekit        DEBUG    Reading descriptor directly...
2019-03-27 16:10:36,199 cekit        DEBUG    Loading override '{"labels": [{"name": "usage", "value": null}]}'
2019-03-27 16:10:36,200 cekit        DEBUG    Reading descriptor directly...
No handlers could be found for logger "pykwalify.core"
2019-03-27 16:10:36,200 cekit        DEBUG    Schema validation failed: <SchemaError: error code 2: Schema validation failed:
 - required.novalue : '/value'.: Path: '/'>
2019-03-27 16:10:36,200 cekit        ERROR    Cannot validate schema: Label
Traceback (most recent call last):
  File "/home/goldmann/git/redhat/cekit/cekit/cli.py", line 336, in run
    command.execute()
  File "/home/goldmann/git/redhat/cekit/cekit/builder.py", line 53, in execute
    self.prepare()
  File "/home/goldmann/git/redhat/cekit/cekit/builder.py", line 74, in prepare
    self.params.overrides)
  File "/home/goldmann/git/redhat/cekit/cekit/generator/docker.py", line 21, in __init__
    super(DockerGenerator, self).__init__(descriptor_path, target, overrides)
  File "/home/goldmann/git/redhat/cekit/cekit/generator/base.py", line 46, in __init__
    override), os.path.dirname(os.path.abspath(override))))
  File "/home/goldmann/git/redhat/cekit/cekit/descriptor/overrides.py", line 18, in __init__
    self._prepare()
  File "/home/goldmann/git/redhat/cekit/cekit/descriptor/image.py", line 53, in _prepare
    self._descriptor['labels'] = [Label(x) for x in self._descriptor.get('labels', [])]
  File "/home/goldmann/git/redhat/cekit/cekit/descriptor/label.py", line 21, in __init__
    super(Label, self).__init__(descriptor)
  File "/home/goldmann/git/redhat/cekit/cekit/descriptor/base.py", line 36, in __init__
    self.__validate()
  File "/home/goldmann/git/redhat/cekit/cekit/descriptor/base.py", line 49, in __validate
    raise CekitError("Cannot validate schema: %s" % (self.__class__.__name__))
CekitError: Cannot validate schema: Label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.