order matters
[mirror/dsa-puppet.git] / modules / resolv / templates / resolv.conf.erb
index 993e7ba..147dfdf 100644 (file)
@@ -8,18 +8,18 @@ nameservers = []
 searchpaths = []
 options = []
 
-if %w{draghi liszt 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')
+options += scope.lookupvar('site::nodeinfo')['hoster']['resolvoptions'] if scope.lookupvar('site::nodeinfo')['hoster']['resolvoptions']
 
+searchpaths += scope.lookupvar('sp')
 searchpaths << "debian.org"
 
 resolvconf  = ''
-resolvconf += "search " + searchpaths.join(" ") + "\n"
+resolvconf += "search " + searchpaths.to_a.flatten.join(" ") + "\n"
 
 if has_variable?('unbound') and unbound and unbound == "true"
   resolvconf += "nameserver 127.0.0.1\n"
@@ -31,7 +31,7 @@ else
     nameservers << '8.8.4.4'
   end
 
-  nameservers.each do |ns|
+  nameservers.to_a.flatten.each do |ns|
     resolvconf += "nameserver " + ns + "\n"
   end
 end