X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=tosca2heat%2Ftosca-parser%2Ftoscaparser%2Felements%2Fartifacttype.py;h=bf379fce57aa4ae6d78399cb0b69912e0bd18998;hb=9a2b86ff190a16822ec3f68b2c1d070d54a47da9;hp=3bfd7d09db1e618c651cb680ca9af656ec98d4f5;hpb=2fa4785aa218cf655f3405d832d2200d64fd033e;p=parser.git diff --git a/tosca2heat/tosca-parser/toscaparser/elements/artifacttype.py b/tosca2heat/tosca-parser/toscaparser/elements/artifacttype.py index 3bfd7d0..bf379fc 100644 --- a/tosca2heat/tosca-parser/toscaparser/elements/artifacttype.py +++ b/tosca2heat/tosca-parser/toscaparser/elements/artifacttype.py @@ -20,6 +20,7 @@ class ArtifactTypeDef(StatefulEntityType): super(ArtifactTypeDef, self).__init__(atype, self.ARTIFACT_PREFIX, custom_def) self.type = atype + self.custom_def = custom_def self.properties = None if self.PROPERTIES in self.defs: self.properties = self.defs[self.PROPERTIES] @@ -27,7 +28,7 @@ class ArtifactTypeDef(StatefulEntityType): def _get_parent_artifacts(self): artifacts = {} - parent_artif = self.parent_type + parent_artif = self.parent_type.type if self.parent_type else None if parent_artif: while parent_artif != 'tosca.artifacts.Root': artifacts[parent_artif] = self.TOSCA_DEF[parent_artif] @@ -36,8 +37,12 @@ class ArtifactTypeDef(StatefulEntityType): @property def parent_type(self): - '''Return an artifact this artifact is derived from.''' - return self.derived_from(self.defs) + '''Return a artifact entity from which this entity is derived.''' + if not hasattr(self, 'defs'): + return None + partifact_entity = self.derived_from(self.defs) + if partifact_entity: + return ArtifactTypeDef(partifact_entity, self.custom_def) def get_artifact(self, name): '''Return the definition of an artifact field by name.'''