summaryrefslogtreecommitdiffstats
path: root/tosca2heat/heat-translator
diff options
context:
space:
mode:
authorshangxdy <shang.xiaodong@zte.com.cn>2016-08-23 10:36:25 +0800
committerjulien zhang <zhang.jun3g@zte.com.cn>2016-08-23 14:24:45 +0000
commit212d539d92a8d0b20af4d8ccb153b744fdc6e303 (patch)
tree1f6646e790397661dd37a5f2823c827bc1d2bfed /tosca2heat/heat-translator
parent1a9b3ea86e026115938b1872ac1fc3bce30055ed (diff)
Replace the policie types with parent type when judging policy node
template in HotResource In class of HotResource, because the policy node template has not interface property, so it is excepted when get all operation from node, but the policy types are enumerated, they are can expressed with parent type. JIRA:PARSER-97 Change-Id: I6393dcaefc774af3aa627ffa287b75083a173f3f Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn> (cherry picked from commit f567dd66c9517acda42559e2c471d40e3401531e)
Diffstat (limited to 'tosca2heat/heat-translator')
-rw-r--r--tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py b/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py
index 261d8ee..8994c63 100644
--- a/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py
+++ b/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py
@@ -357,9 +357,10 @@ class HotResource(object):
node_type = node.type_definition
if isinstance(node_type, str) or \
- node_type.type == "tosca.policies.Placement" or \
- node_type.type == "tosca.policies.Colocate" or \
- node_type.type == "tosca.policies.Antilocate":
+ node_type.is_derived_from("tosca.policies.Root"):
+ # node_type.type == "tosca.policies.Placement" or \
+ # node_type.type == "tosca.policies.Placement.Colocate" or \
+ # node_type.type == "tosca.policies.Placement.Antilocate":
return operations
while True:
@@ -377,9 +378,10 @@ class HotResource(object):
def _get_interface_operations_from_type(node_type, node, lifecycle_name):
operations = {}
if isinstance(node_type, str) or \
- node_type.type == "tosca.policies.Placement" or \
- node_type.type == "tosca.policies.Colocate" or \
- node_type.type == "tosca.policies.Antilocate":
+ node_type.is_derived_from("tosca.policies.Root"):
+ # node_type.type == "tosca.policies.Placement" or \
+ # node_type.type == "tosca.policies.Placement.Colocate" or \
+ # node_type.type == "tosca.policies.Placement.Antilocate":
return operations
if node_type.interfaces and lifecycle_name in node_type.interfaces:
for name, elems in node_type.interfaces[lifecycle_name].items():
@@ -396,8 +398,8 @@ class HotResource(object):
def get_base_type(node_type):
if node_type.parent_type is not None:
if node_type.parent_type.type.endswith('.Root') or \
- node_type.type == "tosca.policies.Colocate" or \
- node_type.type == "tosca.policies.Antilocate":
+ node_type.type == "tosca.policies.Placement.Colocate" or \
+ node_type.type == "tosca.policies.Placement.Antilocate":
return node_type
else:
return HotResource.get_base_type(node_type.parent_type)