X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fresolv%2Ftemplates%2Fresolv.conf.erb;h=2ca70739f6a8c2199e11ad24194bccbd5de85128;hb=d7fb8496f111e456de0a76540ffbb7b7a2be98b0;hp=67f8d64a5462e0ac376f4fceaf9d93c1019843e9;hpb=d4f6ae4b33cd6f3d05a891bbea1310a838e9b9e3;p=mirror%2Fdsa-puppet.git diff --git a/modules/resolv/templates/resolv.conf.erb b/modules/resolv/templates/resolv.conf.erb index 67f8d64a5..2ca70739f 100644 --- a/modules/resolv/templates/resolv.conf.erb +++ b/modules/resolv/templates/resolv.conf.erb @@ -8,30 +8,30 @@ nameservers = [] searchpaths = [] options = [] -if %w{draghi liszt widor spohr}.include?(hostname) +if %w{draghi liszt}.include?(hostname) nameservers << "127.0.0.1" end -nameservers += nodeinfo['hoster']['nameservers'] if nodeinfo['hoster']['nameservers'] -searchpaths += nodeinfo['hoster']['searchpaths'] if nodeinfo['hoster']['searchpaths'] -options += nodeinfo['hoster']['resolvoptions'] if nodeinfo['hoster']['resolvoptions'] +nameservers += scope.lookupvar('ns') +searchpaths += scope.lookupvar('site::nodeinfo')['hoster']['searchpaths'] if scope.lookupvar('site::nodeinfo')['hoster']['searchpaths'] +options += scope.lookupvar('site::nodeinfo')['hoster']['resolvoptions'] if scope.lookupvar('site::nodeinfo')['hoster']['resolvoptions'] searchpaths << "debian.org" resolvconf = '' resolvconf += "search " + searchpaths.join(" ") + "\n" -if defined?(unbound) and unbound and unbound == "true" +if has_variable?('unbound') and unbound and unbound == "true" resolvconf += "nameserver 127.0.0.1\n" else if nameservers.empty? #raise Puppet::ParseError, "Something has gone wrong writing resolv.conf. No nameservers to use!" - scope.function_warning("Something has gone wrong writing resolv.conf. No nameservers to use - using google's!") + scope.function_warning(["Something has gone wrong writing resolv.conf. No nameservers to use - using google's!"]) nameservers << '8.8.8.8' nameservers << '8.8.4.4' end - nameservers.each do |ns| + nameservers.to_a.flatten.each do |ns| resolvconf += "nameserver " + ns + "\n" end end