diff --git a/src/hostinfo/named.py b/src/hostinfo/named.py index 89b21b8b3c34e29bc751a20913f4ab71416177f5..08dc74da2b9737ad2982030bc0f55ef416d0fe28 100755 --- a/src/hostinfo/named.py +++ b/src/hostinfo/named.py @@ -136,17 +136,6 @@ def header(tree, domain, origin=None): util.fqn(tree, ns._parent)) pass pass - delegation = [] - for ns in tree._host_._interface_._nameserver_: - if ns.external[0] != 'yes': - continue - subdomain = ns.domain[0].split('.') - if subdomain[1:] == domain.split('.'): - delegation.append( '%-16sIN NS %s' % - (subdomain[0], util.fqn(tree, ns._parent))) - - for d in sorted(delegation): - result += d result += ";" return result @@ -245,6 +234,20 @@ def generate_forward(tree, hosts): |; |localhost IN A 127.0.0.1 |;""") + delegation = [] + for ns in [ n for n in tree._host_._interface_._nameserver_ + if n.primary[0] == 'yes' ]: + subdomain = ns.domain[0].split('.') + if subdomain[1:] == domain.split('.'): + delegation.append( '%-16sIN NS %s' % + (subdomain[0], util.fqn(tree, ns._parent))) + pass + pass + if delegation: + for d in sorted(delegation): + result += d + pass + result += ";" return result result = DomainDict(callback)