Fix parent types if relationships
1. Fix passing arguments when parent type is taken 2. Take parent interfaces when interfaces are taken 3. Choose custom definitions first when capability type is taken Change-Id: Ifb74a2a68bf627323ff6bfe5a8d5e0a9a222f86b Closes-Bug: #1929616
This commit is contained in:
parent
88988bba17
commit
ca3a2a8804
@ -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
|
||||
|
||||
|
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user