cleanup that should not change anything
[mirror/dsa-puppet.git] / modules / puppetmaster / lib / puppet / parser / functions / nodeinfo.rb
index 7698df3..303dfd2 100644 (file)
@@ -13,7 +13,7 @@ module Puppet::Parser::Functions
         raise Puppet::ParseError, "Host #{host} does not have ipHostNumber values in ldap"
       end
       nodeinfo['hoster'] = function_whohosts(nodeinfo['ldap']['ipHostNumber'], "/etc/puppet/modules/debian-org/misc/hoster.yaml")
-      nodeinfo['buildd'] = (nodeinfo['ldap']['purpose'] && nodeinfo['ldap']['purpose'].include?('buildd'))
+      nodeinfo['buildd'] = (nodeinfo['ldap']['purpose'].respond_to?('include?') && nodeinfo['ldap']['purpose'].include?('buildd'))
 
       if lookupvar('::mta') == 'exim4'
         unless nodeinfo['heavy_exim']
@@ -39,15 +39,16 @@ module Puppet::Parser::Functions
         end
       end
 
-      if not nodeinfo['hoster']['nameservers'] or nodeinfo['hoster']['nameservers'].empty?
+      ns = function_hiera('nameservers')
+      if ns.empty?
         # no nameservers known for this hoster
         nodeinfo['misc']['resolver-recursive'] = true
 
         if nodeinfo['hoster']['allow_dns_query']
           raise Puppet::ParseError, "No nameservers listed for #{nodeinfo['hoster']['name']} yet we should answer somebody's queries?  That makes no sense."
         end
-      elsif (nodeinfo['misc']['v4addrs'] and (nodeinfo['hoster']['nameservers'] & nodeinfo['misc']['v4addrs']).size > 0) or
-            (nodeinfo['misc']['v6addrs'] and (nodeinfo['hoster']['nameservers'] & nodeinfo['misc']['v6addrs']).size > 0)
+      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