summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/Hostbase.py
diff options
context:
space:
mode:
authorKen Raffenetti <raffenet@mcs.anl.gov>2006-09-21 21:57:44 +0000
committerKen Raffenetti <raffenet@mcs.anl.gov>2006-09-21 21:57:44 +0000
commitec7999775cc74f3eee97b84eb4e4ef9341da594b (patch)
treef67c8f956a03010badd88b775446d3e92eb0621e /src/lib/Server/Plugins/Hostbase.py
parent1e2efbb211c375d384a17f4ff7bccba366202076 (diff)
downloadbcfg2-ec7999775cc74f3eee97b84eb4e4ef9341da594b.tar.gz
bcfg2-ec7999775cc74f3eee97b84eb4e4ef9341da594b.tar.bz2
bcfg2-ec7999775cc74f3eee97b84eb4e4ef9341da594b.zip
tweaks to dhcp generation
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2297 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Plugins/Hostbase.py')
-rw-r--r--src/lib/Server/Plugins/Hostbase.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/Server/Plugins/Hostbase.py b/src/lib/Server/Plugins/Hostbase.py
index bc5468926..36d2a348d 100644
--- a/src/lib/Server/Plugins/Hostbase.py
+++ b/src/lib/Server/Plugins/Hostbase.py
@@ -9,7 +9,7 @@ from Bcfg2.Server.Plugin import Plugin, PluginExecutionError, PluginInitError, D
from time import strftime
from sets import Set
import re
-
+from django.template import loader, Context
## class DataNexus(DirectoryBacked):
## '''DataNexus is an object that watches multiple files and
@@ -61,7 +61,7 @@ class Hostbase(Plugin):
'reversesoa':Template(open(self.data + '/templates/' + 'reversesoa.tmpl').read()),
'named':Template(open(self.data + '/templates/' + 'named.tmpl').read()),
'reverseapp':Template(open(self.data + '/templates/' + 'reverseappend.tmpl').read()),
- 'dhcp':Template(open(self.data + '/templates/' + 'dhcpd.tmpl').read()),
+ 'dhcp':loader.get_template('dhcpd.tmpl'),
'hosts':Template(open(self.data + '/templates/' + 'hosts.tmpl').read()),
'hostsapp':Template(open(self.data + '/templates/' + 'hostsappend.tmpl').read()),
}
@@ -300,11 +300,13 @@ class Hostbase(Plugin):
if hostdata not in hosts:
hosts.append(hostdata)
- self.templates['dhcp'].hosts = hosts
- self.templates['dhcp'].numips = len(hosts)
- self.templates['dhcp'].timecreated = strftime("%a %b %d %H:%M:%S %Z %Y")
+ context = Context({
+ 'hosts': hosts,
+ 'numips': len(hosts),
+ 'timecreated': strftime("%a %b %d %H:%M:%S %Z %Y"),
+ })
- self.filedata['dhcpd.conf'] = str(self.templates['dhcp'])
+ self.filedata['dhcpd.conf'] = self.templates['dhcp'].render(context)
self.Entries['ConfigFile']['/etc/dhcpd.conf'] = self.FetchFile