Move all roles from local.yaml to hiera
[mirror/dsa-puppet.git] / modules / exim / templates / manualroute.erb
index 2b84b4e..21a194e 100644 (file)
@@ -5,27 +5,29 @@
 ## Format:
 ## domain: hostname[::port] options
 ## example:
-## buildd.debian.org: raff.debian.org::587 byname
+## buildd.debian.org: grieg.debian.org::587 byname
 
 <%=
-mxmatches = [ fqdn ]
+mxmatches = [ scope.lookupvar('::fqdn') ]
 routes = []
 extraroutes = []
 
-case fqdn
-when 'spohr.debian.org', 'draghi.debian.org', 'merikanto.debian.org' then
+if scope.function_has_role('mailrelay')
   mxmatches << 'mailout.debian.org'
+  mxmatches << 'INCOMING-MX'
   extraroutes = [ "keyring.debian.org:\t\tkaufmann.debian.org" ]
+  extraroutes << "www-master.debian.org:\t\twolkenstein.debian.org"
 end
 
-mxregex = Regexp.new('^\d+\s+(.*)\.$')
-mxinfo.keys.sort.each do |host|
-  mxinfo[host]['mXRecord'].each do |mx|
+mxregex = Regexp.new('^\d+\s+(.*?)\.?$')
+scope.lookupvar('site::allnodeinfo').keys.sort.each do |host|
+  next unless scope.lookupvar('site::allnodeinfo')[host]['mXRecord']
+  scope.lookupvar('site::allnodeinfo')[host]['mXRecord'].each do |mx|
     mxmatch = mxregex.match(mx)
     if mxmatches.include?(mxmatch[1])
       route = host + ":\t\t" + host
-      if localinfo.has_key?(host) and localinfo[host].has_key?('mail_port') and localinfo[host]['mail_port'].to_s != ''
-        route += "::" + localinfo[host]['mail_port'].to_s
+      if scope.lookupvar('site::localinfo').has_key?(host) and scope.lookupvar('site::localinfo')[host].has_key?('mail_port') and scope.lookupvar('site::localinfo')[host]['mail_port'].to_s != ''
+        route += "::" + scope.lookupvar('site::localinfo')[host]['mail_port'].to_s
       end
       routes << route
     end