summaryrefslogtreecommitdiffstats
path: root/tosca2heat/heat-translator/translator/hot/syntax
diff options
context:
space:
mode:
Diffstat (limited to 'tosca2heat/heat-translator/translator/hot/syntax')
-rw-r--r--tosca2heat/heat-translator/translator/hot/syntax/hot_output.py7
-rw-r--r--tosca2heat/heat-translator/translator/hot/syntax/hot_resource.py36
-rw-r--r--tosca2heat/heat-translator/translator/hot/syntax/hot_template.py1
3 files changed, 11 insertions, 33 deletions
diff --git a/tosca2heat/heat-translator/translator/hot/syntax/hot_output.py b/tosca2heat/heat-translator/translator/hot/syntax/hot_output.py
index a41208a..ad77fb3 100644
--- a/tosca2heat/heat-translator/translator/hot/syntax/hot_output.py
+++ b/tosca2heat/heat-translator/translator/hot/syntax/hot_output.py
@@ -21,8 +21,5 @@ class HotOutput(object):
self.description = description
def get_dict_output(self):
- if self.description:
- return {self.name: {'value': self.value,
- 'description': self.description}}
- else:
- return {self.name: {'value': self.value}}
+ return {self.name: {'value': self.value,
+ 'description': self.description}}
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
diff --git a/tosca2heat/heat-translator/translator/hot/syntax/hot_template.py b/tosca2heat/heat-translator/translator/hot/syntax/hot_template.py
index 0403562..4263c4d 100644
--- a/tosca2heat/heat-translator/translator/hot/syntax/hot_template.py
+++ b/tosca2heat/heat-translator/translator/hot/syntax/hot_template.py
@@ -77,7 +77,6 @@ class HotTemplate(object):
dict_output.update({self.OUTPUTS: all_outputs})
yaml.add_representer(OrderedDict, self.represent_ordereddict)
- yaml.add_representer(dict, self.represent_ordereddict)
yaml_string = yaml.dump(dict_output, default_flow_style=False)
# get rid of the '' from yaml.dump around numbers
yaml_string = yaml_string.replace('\'', '')