Handle the writing of side files in a generic way in the stdout case
Change-Id: Ic576bb56418ab8bc944949e2c725533311644800
This commit is contained in:
parent
45db426acb
commit
452e935657
@ -79,10 +79,6 @@ class ToscaAutoscaling(HotResource):
|
||||
dict_res[res_name]
|
||||
yaml.add_representer(OrderedDict, self.represent_ordereddict)
|
||||
yaml.add_representer(dict, self.represent_ordereddict)
|
||||
# TODO(mvelten) (spzala) remove writing the yaml file here,
|
||||
# once embed_substack_templates is correctly implemented
|
||||
with open(self.policy.name + '_res.yaml', 'w') as nested_tpl:
|
||||
yaml.dump(template_dict, nested_tpl, default_flow_style=False)
|
||||
self.nested_template = {
|
||||
self.policy.name + '_res.yaml':
|
||||
yaml.dump(template_dict, default_flow_style=False)
|
||||
|
@ -12,6 +12,7 @@
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import six
|
||||
from toscaparser.utils.gettextutils import _
|
||||
from translator.hot.syntax.hot_template import HotTemplate
|
||||
from translator.hot.translate_inputs import TranslateInputs
|
||||
@ -55,8 +56,20 @@ class TOSCATranslator(object):
|
||||
as a separate file.
|
||||
"""
|
||||
self._translate_to_hot_yaml()
|
||||
return self.hot_template.output_to_yaml(
|
||||
|
||||
# TODO(mvelten) go back to calling hot_template.output_to_yaml instead
|
||||
# for stdout once embed_substack_templates is correctly implemented
|
||||
# return self.hot_template.output_to_yaml(
|
||||
# self.node_translator.hot_template_version)
|
||||
yaml_files = self.hot_template.output_to_yaml_files_dict(
|
||||
"output.yaml",
|
||||
self.node_translator.hot_template_version)
|
||||
for name, content in six.iteritems(yaml_files):
|
||||
if name != "output.yaml":
|
||||
with open(name, 'w+') as f:
|
||||
f.write(content)
|
||||
|
||||
return yaml_files["output.yaml"]
|
||||
|
||||
def translate_to_yaml_files_dict(self, base_filename):
|
||||
"""Translate to HOT YAML
|
||||
|
Loading…
Reference in New Issue
Block a user