def render_templates(template_dict, arguments): rendered_templates = dict() templates = load_templates(template_dict) for name, templates in templates.items(): full_template = None for template in templates: rendered_template = template.render(arguments) # If not yaml, just treat opaquely. if not name.endswith('.yaml'): # No merging support currently. assert len(templates) == 1 full_template = rendered_template continue template_data = yaml.safe_load(rendered_template) if full_template: full_template = merge_dictionaries(full_template, template_data) else: full_template = template_data rendered_templates[name] = full_template return rendered_templates
def render_templates(template_dict, arguments): rendered_templates = dict() templates = load_templates(template_dict) for name, templates in templates.items(): full_template = None for template in templates: rendered_template = template.render(arguments) # If not yaml, just treat opaquely. if not name.endswith('.yaml'): # No merging support currently. assert len(templates) == 1 full_template = rendered_template continue template_data = yaml.load(rendered_template) if full_template: full_template = merge_dictionaries(full_template, template_data) else: full_template = template_data rendered_templates[name] = full_template return rendered_templates