diff options
author | shangxdy <shang.xiaodong@zte.com.cn> | 2016-08-23 10:36:25 +0800 |
---|---|---|
committer | shangxdy <shang.xiaodong@zte.com.cn> | 2016-08-23 10:36:25 +0800 |
commit | f567dd66c9517acda42559e2c471d40e3401531e (patch) | |
tree | 0081f301f906aaa0568d903643c643fc1e6a31af /tosca2heat | |
parent | d93490753ba93e4c3aa00cd487855e3d2970ae9a (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>
Diffstat (limited to 'tosca2heat')
-rw-r--r-- | tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py | 18 |
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) |