move template 'exists' and 'glob' to self.builtins
otherwise, assigning to runner.defaults clobbers them. oops.
This commit is contained in:
parent
ebdf223497
commit
2e8d5c78b8
@ -106,10 +106,10 @@ class LoraxTemplateRunner(object):
|
|||||||
self.yum = yum
|
self.yum = yum
|
||||||
self.fatalerrors = fatalerrors
|
self.fatalerrors = fatalerrors
|
||||||
self.templatedir = templatedir
|
self.templatedir = templatedir
|
||||||
# defaults starts with some builtin methods
|
# some builtin methods
|
||||||
self.defaults = DataHolder(exists=lambda p: rexists(p, root=inroot),
|
self.builtins = DataHolder(exists=lambda p: rexists(p, root=inroot),
|
||||||
glob=lambda g: rglob(g, 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
|
self.results = DataHolder(treeinfo=dict()) # just treeinfo for now
|
||||||
|
|
||||||
def _out(self, path):
|
def _out(self, path):
|
||||||
@ -122,7 +122,7 @@ class LoraxTemplateRunner(object):
|
|||||||
return set([f for pkg in pkglist.installed for f in pkg.filelist])
|
return set([f for pkg in pkglist.installed for f in pkg.filelist])
|
||||||
|
|
||||||
def run(self, templatefile, **variables):
|
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)
|
variables.setdefault(k,v)
|
||||||
logger.info("parsing %s", templatefile)
|
logger.info("parsing %s", templatefile)
|
||||||
t = LoraxTemplate(directories=[self.templatedir])
|
t = LoraxTemplate(directories=[self.templatedir])
|
||||||
|
Loading…
Reference in New Issue
Block a user