def _prepare(self): self._descriptor['labels'] = [ Label(x) for x in self._descriptor.get('labels', []) ] self._descriptor['envs'] = [ Env(x) for x in self._descriptor.get('envs', []) ] self._descriptor['ports'] = [ Port(x) for x in self._descriptor.get('ports', []) ] if 'run' in self._descriptor: self._descriptor['run'] = Run(self._descriptor['run']) self._descriptor['artifacts'] = [ create_resource(a, directory=self._artifact_dir) for a in self._descriptor.get('artifacts', []) ] self._descriptor['modules'] = Modules( self._descriptor.get('modules', {}), self.path) self._descriptor['packages'] = Packages( self._descriptor.get('packages', {}), self.path) self._descriptor['osbs'] = Osbs(self._descriptor.get('osbs', {}), self.path) self._descriptor['volumes'] = [ Volume(x) for x in self._descriptor.get('volumes', []) ] # make sure image declarations override any module definitions self._image_overrides = { 'artifacts': Image._to_dict(self.artifacts), 'modules': Image._to_dict(self.modules.install) } self._all_artifacts = Image._to_dict(self.artifacts)
def modules(self): return self.get('modules', Modules({}, self._artifact_dir))
def _prepare(self): """Updates self._descriptor with objects and prepare sane label""" self._descriptor['labels'] = self._descriptor.get('labels', []) # we will persist cekit version in a label here, so we know which version of cekit # was used to build the image self['labels'].extend([{ 'name': 'org.concrt.version', 'value': cekit_version }, { 'name': 'io.cekit.version', 'value': cekit_version }]) # The description key available in image descriptor's # root is added as labels to the image key = 'description' # If we define the label in the image descriptor # we should *not* override it with value from # the root's key if key in self._descriptor and not self.label(key): value = self._descriptor[key] self._descriptor['labels'].append({'name': key, 'value': value}) # Last - if there is no 'summary' label added to image descriptor # we should use the value of the 'description' key and create # a 'summary' label with it's content. If there is even that # key missing - we should not add anything. description = self.label('description') if not self.label('summary') and description: self._descriptor['labels'].append({ 'name': 'summary', 'value': description['value'] }) self._descriptor['labels'] = [ Label(x) for x in self._descriptor.get('labels', []) ] self._descriptor['envs'] = [ Env(x) for x in self._descriptor.get('envs', []) ] self._descriptor['ports'] = [ Port(x) for x in self._descriptor.get('ports', []) ] if 'run' in self._descriptor: self._descriptor['run'] = Run(self._descriptor['run']) self._descriptor['artifacts'] = [ Resource(a, directory=self._artifact_dir) for a in self._descriptor.get('artifacts', []) ] if 'modules' in self._descriptor: self._descriptor['modules'] = Modules(self._descriptor['modules'], self.path) if 'packages' in self._descriptor: self._descriptor['packages'] = Packages( self._descriptor['packages']) if 'osbs' in self._descriptor: self._descriptor['osbs'] = Osbs(self._descriptor['osbs']) self._descriptor['volumes'] = [ Volume(x) for x in self._descriptor.get('volumes', []) ]