From 2e8d5c78b8daa9873e125fdf58367e3894c4c2f4 Mon Sep 17 00:00:00 2001 From: Will Woods Date: Thu, 30 Jun 2011 16:59:55 -0400 Subject: [PATCH] move template 'exists' and 'glob' to self.builtins otherwise, assigning to runner.defaults clobbers them. oops. --- src/pylorax/ltmpl.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pylorax/ltmpl.py b/src/pylorax/ltmpl.py index 9b5f4043..ba3faa22 100644 --- a/src/pylorax/ltmpl.py +++ b/src/pylorax/ltmpl.py @@ -106,10 +106,10 @@ class LoraxTemplateRunner(object): self.yum = yum self.fatalerrors = fatalerrors self.templatedir = templatedir - # defaults starts with some builtin methods - self.defaults = DataHolder(exists=lambda p: rexists(p, root=inroot), + # some builtin methods + self.builtins = DataHolder(exists=lambda p: rexists(p, root=inroot), glob=lambda g: rglob(g, root=inroot)) - self.defaults.update(defaults) + self.defaults = defaults self.results = DataHolder(treeinfo=dict()) # just treeinfo for now def _out(self, path): @@ -122,7 +122,7 @@ class LoraxTemplateRunner(object): return set([f for pkg in pkglist.installed for f in pkg.filelist]) def run(self, templatefile, **variables): - for k,v in self.defaults.items(): + for k,v in self.defaults.items() + self.builtins.items(): variables.setdefault(k,v) logger.info("parsing %s", templatefile) t = LoraxTemplate(directories=[self.templatedir])