From 63ba097865e1d038d82a7fa1d6efd282784677f5 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 26 Jan 2010 16:40:10 -0500 Subject: move writing sources.list to CloudConfig. add 'apt_preserve_sources_list' Move the writing of sources.list to CloudConfig. This way we have access to the cloud-config user data. Then, allow the user to specify the archive mirror using 'apt_mirror' key. Now, if specified in cloud-config, that is used, otherwise, we get one from the DataSource. One other change here is adding 'apt_preserve_sources_list'. If set to true, then overwriting of the sources.list with the selected mirror will not be done. --- ec2init/util.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ec2init/util.py') 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() + -- cgit v1.2.3