summaryrefslogtreecommitdiff
path: root/ec2init/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'ec2init/util.py')
-rw-r--r--ec2init/util.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/ec2init/util.py b/ec2init/util.py
index ece5755a..403832ff 100644
--- a/ec2init/util.py
+++ b/ec2init/util.py
@@ -2,6 +2,7 @@ import yaml
import os
import errno
import subprocess
+from Cheetah.Template import Template
def read_conf(fname):
stream = file(fname)
@@ -69,3 +70,10 @@ def subp(args, input=None):
if sp.returncode is not 0:
raise subprocess.CalledProcessError(sp.returncode,args)
return(out,err)
+
+def render_to_file(template, outfile, searchList):
+ t = Template(file='/etc/ec2-init/templates/%s.tmpl' % template, searchList=[searchList])
+ f = open(outfile, 'w')
+ f.write(t.respond())
+ f.close()
+