Merge "Fix parent types if relationships"

This commit is contained in:
Zuul 2021-07-28 05:20:50 +00:00 committed by Gerrit Code Review
commit 0014362ab1
2 changed files with 16 additions and 5 deletions

View File

@ -66,10 +66,10 @@ class CapabilityTypeDef(StatefulEntityType):
if parent_cap:
parent_cap = parent_cap.type
while parent_cap != self.TOSCA_TYPEURI_CAPABILITY_ROOT:
if parent_cap in self.TOSCA_DEF.keys():
capabilities[parent_cap] = self.TOSCA_DEF[parent_cap]
elif custom_def and parent_cap in custom_def.keys():
if custom_def and parent_cap in custom_def.keys():
capabilities[parent_cap] = custom_def[parent_cap]
elif parent_cap in self.TOSCA_DEF.keys():
capabilities[parent_cap] = self.TOSCA_DEF[parent_cap]
parent_cap = capabilities[parent_cap]['derived_from']
return capabilities

View File

@ -35,11 +35,22 @@ class RelationshipType(StatefulEntityType):
'''Return a relationship this reletionship is derived from.'''
prel = self.derived_from(self.defs)
if prel:
return RelationshipType(prel, self.custom_def)
return RelationshipType(prel, custom_def=self.custom_def)
@property
def interfaces(self):
return self.get_value(self.INTERFACES)
interfaces = self.get_value(self.INTERFACES)
if self.parent_type is not None:
if self.parent_type.interfaces is not None:
import copy
parent_interfaces = copy.deepcopy(self.parent_type.interfaces)
if parent_interfaces:
if interfaces:
parent_interfaces.update(interfaces)
interfaces = parent_interfaces
return interfaces
@property
def valid_target_types(self):