- if not nodeinfo['hoster']['nameservers'] or nodeinfo['hoster']['nameservers'].empty?
- # no nameservers known for this hoster
- nodeinfo['misc']['resolver-recursive'] = true
- elsif (nodeinfo['hoster']['nameservers'] & nodeinfo['misc']['v4addrs']).size > 0 or
- (nodeinfo['hoster']['nameservers'] & nodeinfo['misc']['v6addrs']).size > 0
- # this host is listed as a nameserver at this location
- nodeinfo['misc']['resolver-recursive'] = true
- else
- nodeinfo['misc']['resolver-recursive'] = false
- end
+ nodeinfo['misc'] = {}
+ fqdn = lookupvar('::fqdn')
+ if fqdn and fqdn == host
+ v4ips = lookupvar('::v4ips')
+ if v4ips and v4ips.to_s != "" and v4ips.to_s != 'undefined'
+ nodeinfo['misc']['v4addrs'] = v4ips.split(',')
+
+ # find out if we are behind nat
+ intersection = nodeinfo['misc']['v4addrs'] & nodeinfo['ldap']['ipHostNumber']
+ nodeinfo['misc']['natted'] = intersection.empty?
+ end
+
+ v6ips = lookupvar('::v6ips')
+ if v6ips and v6ips.to_s != "" and v6ips.to_s != 'undefined'
+ nodeinfo['misc']['v6addrs'] = v6ips.split(',')
+ end
+ end
+
+ ns = function_hiera(['nameservers'])
+ allow_dns_q = function_hiera(['allow_dns_query'])
+ if ns.empty?
+ # no nameservers known for this hoster
+ nodeinfo['misc']['resolver-recursive'] = true
+
+ if not allow_dns_q.empty?
+ raise Puppet::ParseError, "No nameservers listed for #{nodeinfo['hoster']['name']} yet we should answer somebody's queries? That makes no sense. allow_dns_q: #{allow_dns_q}."
+ end
+ elsif (nodeinfo['misc']['v4addrs'] and (ns & nodeinfo['misc']['v4addrs']).size > 0) or
+ (nodeinfo['misc']['v6addrs'] and (ns & nodeinfo['misc']['v6addrs']).size > 0)
+ # this host is listed as a nameserver at this location
+ nodeinfo['misc']['resolver-recursive'] = true