2 # Licensed under the Apache License, Version 2.0 (the "License"); you may
3 # not use this file except in compliance with the License. You may obtain
4 # a copy of the License at
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11 # License for the specific language governing permissions and limitations
16 from toscaparser.utils.gettextutils import _
17 from translator.hot.syntax.hot_output import HotOutput
19 log = logging.getLogger('heat-translator')
22 class TranslateOutputs(object):
23 '''Translate TOSCA Outputs to Heat Outputs.'''
25 def __init__(self, outputs, node_translator):
26 log.debug(_('Translating TOSCA outputs to HOT outputs.'))
27 self.outputs = outputs
28 self.nodes = node_translator
31 return self._translate_outputs()
33 def _translate_outputs(self):
35 for output in self.outputs:
36 hot_value = self.nodes.translate_param_value(output.value, None)
37 if hot_value is not None:
38 hot_outputs.append(HotOutput(output.name, hot_value,