Commit a7e6f2ad authored by aoh's avatar aoh
Browse files

generator.py: Full paths

parent 65626c7a
......@@ -61,7 +61,8 @@ if __name__ == '__main__':
env = Environment(loader = FileSystemLoader('.'))
# Keys
with open("keys", "w") as keys_file, DB() as d:
# XXX This file should be included from named.conf
with open("/usr/local/etc/namedb/keys", "w") as keys_file, DB() as d:
for id in d.get_domain_ids():
domain_name = d.get_domain_name(id)
for sid in d.get_subdomain_ids(id):
......@@ -70,7 +71,7 @@ if __name__ == '__main__':
fqdn = subdomain_name + '.' + domain_name
key = Key(fqdn, 'hmac-md5', d.get_key(sid))
rendered_key = key_template.render(keylist = [ key ])
keys_file.write(rendered_key) # TODO This file should be included from named.conf
keys_file.write(rendered_key)
# Zones
zones = list()
......@@ -90,8 +91,10 @@ if __name__ == '__main__':
'/usr/local/etc/namedb/master/' + domain_name)
zones.append(zone)
rendered_zone = zone_template.render(zonelist = zones)
with open("zones", "w") as zones_file:
zones_file.write(rendered_zone) # TODO This file should be included from named.conf
# XXX This file should be included from named.conf
with open("/usr/local/etc/namedb/zones", "w") as zones_file:
zones_file.write(rendered_zone)
# Zonefile
with DB() as d:
......@@ -121,6 +124,5 @@ if __name__ == '__main__':
nameserver = zonefile.nameserver,
hostmaster = zonefile.hostmaster,
recordlist = zonefile.recordlist)
# TODO change this to in "/usr/local/etc/namedb/master/" + domain_name
with open(domain_name, "w") as zonefile_file:
with open("/usr/local/etc/namedb/master/" + domain_name, "w") as zonefile_file:
zonefile_file.write(rendered_zonefile)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment