Exemplo n.º 1
0
 def _outputs(self):
     outputs = []
     for name, attrs in self._tpl_outputs().items():
         output = Output(name, attrs)
         output.validate()
         outputs.append(output)
     return outputs
Exemplo n.º 2
0
 def _outputs(self):
     outputs = []
     for name, attrs in self._tpl_outputs().items():
         output = Output(name, attrs)
         output.validate()
         outputs.append(output)
     return outputs
 def _outputs(self):
     outputs = []
     for name, attrs in self._tpl_outputs().items():
         exception.TOSCAException.set_context("output", name)
         output = Output(name, attrs)
         output.validate()
         outputs.append(output)
     exception.TOSCAException.reset_context()
     return outputs
Exemplo n.º 4
0
    def test_outputs(self):
        tpl_snippet = '''
        outputs:
          server_address:
            description: IP address of server instance.
            values: { get_property: [server, private_address] }
        '''
        outputs = (
            toscaparser.utils.yamlparser.simple_parse(tpl_snippet)['outputs'])
        name, attrs = list(outputs.items())[0]
        output = Output(name, attrs)
        try:
            output.validate()
        except Exception as err:
            self.assertTrue(
                isinstance(err, exception.MissingRequiredFieldError))
            self.assertEqual(
                _('Output "server_address" is missing required '
                  'field "value".'), err.__str__())

        tpl_snippet = '''
        outputs:
          server_address:
            descriptions: IP address of server instance.
            value: { get_property: [server, private_address] }
        '''
        outputs = (
            toscaparser.utils.yamlparser.simple_parse(tpl_snippet)['outputs'])
        name, attrs = list(outputs.items())[0]
        output = Output(name, attrs)
        try:
            output.validate()
        except Exception as err:
            self.assertTrue(isinstance(err, exception.UnknownFieldError))
            self.assertEqual(
                _('Output "server_address" contains unknown '
                  'field "descriptions". Refer to the definition '
                  'to verify valid values.'), err.__str__())
    def test_outputs(self):
        tpl_snippet = '''
        outputs:
          server_address:
            description: IP address of server instance.
            values: { get_property: [server, private_address] }
        '''
        outputs = (toscaparser.utils.yamlparser.
                   simple_parse(tpl_snippet)['outputs'])
        name, attrs = list(outputs.items())[0]
        output = Output(name, attrs)
        try:
            output.validate()
        except Exception as err:
            self.assertTrue(
                isinstance(err, exception.MissingRequiredFieldError))
            self.assertEqual('Output server_address is missing required '
                             'field: "value".', err.__str__())

        tpl_snippet = '''
        outputs:
          server_address:
            descriptions: IP address of server instance.
            value: { get_property: [server, private_address] }
        '''
        outputs = (toscaparser.utils.yamlparser.
                   simple_parse(tpl_snippet)['outputs'])
        name, attrs = list(outputs.items())[0]
        output = Output(name, attrs)
        try:
            output.validate()
        except Exception as err:
            self.assertTrue(isinstance(err, exception.UnknownFieldError))
            self.assertEqual('Output server_address contain(s) unknown '
                             'field: "descriptions", refer to the definition '
                             'to verify valid values.',
                             err.__str__())
Exemplo n.º 6
0
 def process_output(output_name, output_attrs):
     orm_output = Output(output_name, output_attrs)
     orm_output.validate()
     outputs.append(orm_output)