diff --git a/src/hostinfo/named.py b/src/hostinfo/named.py index 0d0a641358a331f6539d651ba7c20517aaf5608f..a83ef2e11f38c6d5f9913da2431fac313765aa7e 100755 --- a/src/hostinfo/named.py +++ b/src/hostinfo/named.py @@ -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