X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fpuppetmaster%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Fnodeinfo.rb;h=303dfd21392685b4a7fdb9af3ba08e3de6762686;hb=6ef393a9864338c2e1085fa80283e8fda848685e;hp=63c6fcaf5c5f01b4c526f797d8db5b036c650ea2;hpb=9f5bc1d031a2ff59d2ff4c444cff24eea1d8d94a;p=mirror%2Fdsa-puppet.git diff --git a/modules/puppetmaster/lib/puppet/parser/functions/nodeinfo.rb b/modules/puppetmaster/lib/puppet/parser/functions/nodeinfo.rb index 63c6fcaf5..303dfd213 100644 --- a/modules/puppetmaster/lib/puppet/parser/functions/nodeinfo.rb +++ b/modules/puppetmaster/lib/puppet/parser/functions/nodeinfo.rb @@ -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'] and 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'] @@ -25,7 +25,7 @@ module Puppet::Parser::Functions fqdn = lookupvar('::fqdn') if fqdn and fqdn == host v4ips = lookupvar('::v4ips') - if v4ips + if v4ips and v4ips.to_s != "" and v4ips.to_s != 'undefined' nodeinfo['misc']['v4addrs'] = v4ips.split(',') # find out if we are behind nat @@ -34,20 +34,21 @@ module Puppet::Parser::Functions end v6ips = lookupvar('::v6ips') - if v6ips and v6ips != "" + if v6ips and v6ips.to_s != "" and v6ips.to_s != 'undefined' nodeinfo['misc']['v6addrs'] = v6ips.split(',') 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