handle templatedir more cleanly in ltmpl/treebuilder

make sure that runner.templatedir gets set to a useful default if
initialized with None, and and make sure we pass templatedir to
LoraxTemplateRunner.__init__ (so it'll get initialized properly)
This commit is contained in:
Will Woods 2011-08-08 19:01:38 -04:00
parent 96ffbc0122
commit 916402b023
2 changed files with 4 additions and 5 deletions

View File

@ -107,7 +107,7 @@ class LoraxTemplateRunner(object):
self.outroot = outroot
self.yum = yum
self.fatalerrors = fatalerrors
self.templatedir = templatedir
self.templatedir = templatedir or "/usr/share/lorax"
# some builtin methods
self.builtins = DataHolder(exists=lambda p: rexists(p, root=inroot),
glob=lambda g: list(rglob(g, root=inroot)))

View File

@ -72,8 +72,8 @@ class RuntimeBuilder(object):
self.vars = DataHolder(arch=arch, product=product, yum=yum, root=root,
basearch=arch.basearch, libdir=arch.libdir)
self.yum = yum
self._runner = LoraxTemplateRunner(inroot=root, outroot=root, yum=yum)
self._runner.templatedir = templatedir
self._runner = LoraxTemplateRunner(inroot=root, outroot=root,
yum=yum, templatedir=templatedir)
self._runner.defaults = self.vars
def install(self):
@ -130,8 +130,7 @@ class TreeBuilder(object):
inroot=inroot, outroot=outroot,
basearch=arch.basearch, libdir=arch.libdir,
udev_escape=udev_escape)
self._runner = LoraxTemplateRunner(inroot, outroot)
self._runner.templatedir = templatedir
self._runner = LoraxTemplateRunner(inroot, outroot, templatedir=templatedir)
self._runner.defaults = self.vars
@property