Commit c3f7a419 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Add support for named/BIND SRV records

parent ae271078
......@@ -194,6 +194,33 @@ def generate_forward(tree, hosts):
for txt in [ t for t in tree._subnet_._txt_ if t.domain[1] == domain]:
result += (' IN TXT "%s"' % (txt.value[0]))
pass
for srv in [ s for s in tree._subnet_._srv_ if s.domain[1] == domain]:
s = {}
if not srv.name[0]:
raise util.HostinfoException('SRV has no name %s' % srv,
where=srv)
if not srv.priority[0]:
raise util.HostinfoException('SRV has no priority %s' % srv,
where=srv)
if not srv.weight[0]:
raise util.HostinfoException('SRV has no weight %s' % srv,
where=srv)
if not srv.port[0]:
raise util.HostinfoException('SRV has no port %s' % srv,
where=srv)
if not srv.host[0]:
raise util.HostinfoException('SRV has no host %s' % srv,
where=srv)
s['name'] = srv.name[0]
s['priority'] = srv.priority[0]
s['weight'] = srv.weight[0]
s['port'] = srv.port[0]
s['host'] = srv.host[0]
s['ttl'] = srv.ttl[0] or ''
result += (
'%(name)s %(ttl)s IN SRV %(priority)s %(weight)s %(port)s %(host)s'
% s)
pass
result.append_lines("""
|;
|localhost IN A 127.0.0.1
......
Supports Markdown
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