コード例 #1
0
def parse_template(template):
    """ parse instantiates a Template object with the provided string contents
    of the template and returns a dict of all the resources defined within it.
    """
    temp = Template(template)
    temp.reduce_functions()
    return temp.parse_resources()
コード例 #2
0
ファイル: parsing.py プロジェクト: cloudbase/heat2arm
def parse_template(template):
    """ parse instantiates a Template object with the provided string contents
    of the template and returns a dict of all the resources defined within it.
    """
    temp = Template(template)
    temp.reduce_functions()
    return temp.parse_resources()
コード例 #3
0
    def test_functions_get_applied(self):
        """ test_functions_get_applied tests that running the function
        application on a Template's data reduces all available functions.
        """
        LOG.debug("testing function application correctness on '%s'.", self._function_application_test_data)
        temp = Template(self._function_application_test_data)
        temp.reduce_functions()

        # for each registered templating function (which are considered to
        # behave correctly, as they have their separate tests), ensure that
        # there is no unapplied instance of it in the resulting template:
        for func_name in temp._functions:
            LOG.debug("checking for unapplied function '%s' in '%s'.", func_name, temp._template_data)
            self.assertFalse(recursive_dict_search(temp._template_data, func_name))
コード例 #4
0
    def test_functions_get_applied(self):
        """ test_functions_get_applied tests that running the function
        application on a Template's data reduces all available functions.
        """
        LOG.debug("testing function application correctness on '%s'.",
                  self._function_application_test_data)
        temp = Template(self._function_application_test_data)
        temp.reduce_functions()

        # for each registered templating function (which are considered to
        # behave correctly, as they have their separate tests), ensure that
        # there is no unapplied instance of it in the resulting template:
        for func_name in temp._functions:
            LOG.debug("checking for unapplied function '%s' in '%s'.",
                      func_name, temp._template_data)
            self.assertFalse(
                recursive_dict_search(temp._template_data, func_name))