summaryrefslogtreecommitdiff
path: root/cloudinit/templater.py
blob: b6b320ab93de4893fe210dfa8806f1be51f10900 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import os

from Cheetah.Template import Template

from cloudinit import util

TEMPLATE_DIR = '/etc/cloud/templates/'


def render_to_file(template, outfile, searchList):
    contents = Template(file=os.path.join(TEMPLATE_DIR, template),
                 searchList=[searchList]).respond()
    util.write_file(outfile, contents)


def render_string(template, searchList):
    return Template(template, searchList=[searchList]).respond()