summaryrefslogtreecommitdiff
path: root/cloudinit/templater.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-06-07 12:42:38 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-06-07 12:42:38 -0700
commit8900f9cba622eeaf3810003c5a6ff7522312277b (patch)
tree96dd5295a29c69eabfede0630f697325149926f3 /cloudinit/templater.py
parent87ebd91af8c230b8f1deed8e734297e40397eea0 (diff)
downloadvyos-cloud-init-8900f9cba622eeaf3810003c5a6ff7522312277b.tar.gz
vyos-cloud-init-8900f9cba622eeaf3810003c5a6ff7522312277b.zip
1. Adding some new helper files that split off file inclusion, templating, importing, constant usage.
1. Move all datasources to a new sources directory 1. Rename some files to be more consistent with python file/module naming.
Diffstat (limited to 'cloudinit/templater.py')
-rw-r--r--cloudinit/templater.py17
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()