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
14 # Copyright 2016 RIFT.io Inc
16 from rift
.mano
.tosca_translator
.common
.utils
import _
17 from rift
.mano
.tosca_translator
.rwmano
.syntax
.mano_output
import ManoOutput
20 class TranslateOutputs(object):
21 '''Translate TOSCA Outputs to Heat Outputs.'''
23 def __init__(self
, log
, outputs
, node_translator
):
24 log
.debug(_('Translating TOSCA outputs to MANO outputs.'))
26 self
.outputs
= outputs
27 self
.nodes
= node_translator
30 return self
._translate
_outputs
()
32 def _translate_outputs(self
):
34 for output
in self
.outputs
:
35 if output
.value
.name
== 'get_attribute':
36 get_parameters
= output
.value
.args
37 mano_target
= self
.nodes
.find_mano_resource(get_parameters
[0])
38 mano_value
= mano_target
.get_mano_attribute(get_parameters
[1],
40 mano_outputs
.append(ManoOutput(output
.name
,
44 mano_outputs
.append(ManoOutput(output
.name
,