diff options
author | 2016-09-14 14:36:33 +0800 | |
---|---|---|
committer | 2016-09-19 14:23:56 +0000 | |
commit | 16d01a2dea9ac5447697b44a8d37dc05cb681f71 (patch) | |
tree | 2b0cfa2aaf72b1d4e4ebef4e2ccbbb091a4f140c /tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py | |
parent | fa44d0821c35d401be256ced90eda934b20bf8d6 (diff) |
Update the upstream of tosco-parser and heat-translator to stable
release 0.6/0.5
Currently the parser is based on dev branch of upstream projects,
include tosco-parser and heat-translator, for the colorado release of
parser, it should be based on a stable version, so it's necessary to
update the upstream version to 0.6/tosca-parser and 0.5/heat-translator.
JIRA:PARSER-106
Change-Id: I8fb043068d25188c47e5648e1b66184446ac82d6
Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
(cherry picked from commit f977b94e012828cd2a905b9b841aff33c4b732f8)
Diffstat (limited to 'tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py')
-rw-r--r-- | tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py b/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py index 7b83906..54e0d96 100644 --- a/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py +++ b/tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py @@ -103,7 +103,7 @@ class HotResource(object): # scenarios and cannot be fixed or hard coded here operations_deploy_sequence = ['create', 'configure', 'start'] - operations = HotResource.get_all_operations(self.nodetemplate) + operations = HotResource._get_all_operations(self.nodetemplate) # create HotResource for each operation used for deployment: # create, start, configure @@ -140,15 +140,7 @@ class HotResource(object): # hosting_server is None if requirements is None hosting_on_server = (hosting_server.name if hosting_server else None) - base_type = HotResource.get_base_type( - self.nodetemplate.type_definition).type - # handle interfaces directly defined on a compute - if hosting_on_server is None \ - and base_type == 'tosca.nodes.Compute': - hosting_on_server = self.name - - if operation.name == reserve_current and \ - base_type != 'tosca.nodes.Compute': + if operation.name == reserve_current: deploy_resource = self self.name = deploy_name self.type = 'OS::Heat::SoftwareDeployment' @@ -156,7 +148,7 @@ class HotResource(object): 'server': {'get_resource': hosting_on_server}, 'signal_transport': 'HEAT_SIGNAL'} - deploy_lookup[operation] = self + deploy_lookup[operation.name] = self else: sd_config = {'config': {'get_resource': config_name}, 'server': {'get_resource': @@ -168,7 +160,7 @@ class HotResource(object): 'OS::Heat::SoftwareDeployment', sd_config) hot_resources.append(deploy_resource) - deploy_lookup[operation] = deploy_resource + deploy_lookup[operation.name] = deploy_resource lifecycle_inputs = self._get_lifecycle_inputs(operation) if lifecycle_inputs: deploy_resource.properties['input_values'] = \ @@ -178,34 +170,24 @@ class HotResource(object): # in operations_deploy_sequence # TODO(anyone): find some better way to encode this implicit sequence group = {} - op_index_max = -1 for op, hot in deploy_lookup.items(): # position to determine potential preceding nodes - op_index = operations_deploy_sequence.index(op.name) - if op_index > op_index_max: - op_index_max = op_index - for preceding_op_name in \ + op_index = operations_deploy_sequence.index(op) + for preceding_op in \ reversed(operations_deploy_sequence[:op_index]): - preceding_hot = deploy_lookup.get( - operations.get(preceding_op_name)) + preceding_hot = deploy_lookup.get(preceding_op) if preceding_hot: hot.depends_on.append(preceding_hot) hot.depends_on_nodes.append(preceding_hot) group[preceding_hot] = hot break - if op_index_max >= 0: - last_deploy = deploy_lookup.get(operations.get( - operations_deploy_sequence[op_index_max])) - else: - last_deploy = None - # save this dependency chain in the set of HOT resources self.group_dependencies.update(group) for hot in hot_resources: hot.group_dependencies.update(group) - return hot_resources, deploy_lookup, last_deploy + return hot_resources def handle_connectsto(self, tosca_source, tosca_target, hot_source, hot_target, config_location, operation): @@ -353,7 +335,7 @@ class HotResource(object): return tosca_props @staticmethod - def get_all_operations(node): + def _get_all_operations(node): operations = {} for operation in node.interfaces: operations[operation.name] = operation |