Esempio n. 1
0
    def get_template_data(template_file):
        if not os.path.exists(template_file):
            return {}

        with io.open(template_file, mode='r', encoding='utf-8') as f:
            try:
                return yaml_parse(f.read())
            except (ValueError, yaml.YAMLError) as ex:
                raise ContextException("Parse template failed: {}".format(str(ex)))
Esempio n. 2
0
    def get_template_data(template_file):
        if not os.path.exists(template_file):
            return {}

        with open(template_file, 'r') as f:
            try:
                return yaml_parse(f.read())
            except (ValueError, yaml.YAMLError) as ex:
                Operation(ex, err_msg=traceback.format_exc(), level="ERROR").no_output()
                raise ContextException("Parse template failed: {}".format(str(ex)))
        return