X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fexim%2Ftemplates%2Fmanualroute.erb;h=40062d8dccd1e7f218624c83c22df2552a870f57;hb=99c219736c3c52f933f120c4411ef8e984f5f9d1;hp=770e95421ba49004b0cac04f633f76595dd8ee8a;hpb=056eeb7efa04117d0bd9f2a0fdb095b4c4c2bb45;p=mirror%2Fdsa-puppet.git diff --git a/modules/exim/templates/manualroute.erb b/modules/exim/templates/manualroute.erb index 770e95421..40062d8dc 100644 --- a/modules/exim/templates/manualroute.erb +++ b/modules/exim/templates/manualroute.erb @@ -8,32 +8,31 @@ ## buildd.debian.org: raff.debian.org::587 byname <%= -routes = case fqdn - when 'spohr.debian.org', 'draghi.debian.org' then ' -ancina.debian.org: ancina.debian.org::2025 -arcadelt.debian.org: arcadelt.debian.org::25 -argento.debian.org: argento.debian.org::25 -brahms.debian.org: brahms.debian.org::25 -goedel.debian.org: goedel.debian.org::25 -goetz.debian.org: goetz.debian.org::25 -kassia.debian.org: kassia.debian.org::587 -lafayette.debian.org: lafayette.debian.org::25 -lebrun.debian.org: lebrun.debian.org::25 -malo.debian.org: malo.debian.org::25 -mayer.debian.org: mayer.debian.org::25 -murphy.debian.org: murphy.debian.org::25 -paer.debian.org: paer.debian.org::25 -piatti.debian.org: piatti.debian.org::2025 -praetorius.debian.org: praetorius.debian.org::25 -puccini.debian.org: puccini.debian.org::25 -rem.debian.org: rem.debian.org::25 -schroeder.debian.org: schroeder.debian.org::25 -spontini.debian.org: spontini.debian.org::25 -' - when 'luchesi.debian.org' then ' -finzi.debian.org: [172.17.12.2]::25 -fano.debian.org: [172.17.12.3]::25 -' +mxmatches = [ fqdn ] +routes = [] +extraroutes = [] + +if nodeinfo['mailrelay'] + mxmatches << 'mailout.debian.org' + extraroutes = [ "keyring.debian.org:\t\tkaufmann.debian.org" ] +end + +mxregex = Regexp.new('^\d+\s+(.*)\.$') +allnodeinfo.keys.sort.each do |host| + next unless allnodeinfo[host]['mXRecord'] + 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 + end + routes << route + end + end end -routes + +routes << extraroutes + +routes.join("\n") %>