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.
This commit is contained in:
17
cloudinit/templater.py
Normal file
17
cloudinit/templater.py
Normal file
@@ -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()
|
||||
Reference in New Issue
Block a user