X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=modules%2Fresolv%2Ftemplates%2Fresolv.conf.erb;h=2e1968b639785d625a38b1cd0e45ffbf58e5ad7d;hb=103e56b48752f77fd66edd1824d82946570ca033;hp=4ba636767beb090e82394574e002c4d21c4a44e8;hpb=79d3cf1d213060df3d8973984cd7f2c64fbfdd01;p=dsa-puppet.git diff --git a/modules/resolv/templates/resolv.conf.erb b/modules/resolv/templates/resolv.conf.erb index 4ba63676..2e1968b6 100644 --- a/modules/resolv/templates/resolv.conf.erb +++ b/modules/resolv/templates/resolv.conf.erb @@ -6,37 +6,37 @@ <%= nameservers = [] searchpaths = [] -options = [] +options = [] +resolvconf = '' -if %w{draghi liszt widor spohr}.include?(hostname) +if %w{draghi}.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('sp') +options += scope.lookupvar('opts') searchpaths << "debian.org" -resolvconf = '' -resolvconf += "search " + searchpaths.join(" ") + "\n" +resolvconf += "search " + searchpaths.to_a.flatten.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!" - STDERR.put "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 -options.each do |opt| +options.to_a.flatten.each do |opt| resolvconf += "options " + opt + "\n" end