diff options
Diffstat (limited to 'cloudinit/templater.py')
-rw-r--r-- | cloudinit/templater.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cloudinit/templater.py b/cloudinit/templater.py new file mode 100644 index 00000000..b6b320ab --- /dev/null +++ b/cloudinit/templater.py @@ -0,0 +1,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() |