Try to avoid reserved site keyword
[mirror/dsa-puppet.git] / modules / exim / templates / manualroute.erb
1 ##
2 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
3 ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
4 ##
5 ## Format:
6 ## domain: hostname[::port] options
7 ## example:
8 ## buildd.debian.org: foobar.debian.org::587 byname
9
10 <%=
11 mxmatches = [ @fqdn ]
12 routes = []
13 extraroutes = []
14
15 if scope.function_has_role(['mailrelay'])
16   mxmatches << 'mailout.debian.org'
17   mxmatches << 'INCOMING-MX'
18   extraroutes = [ ]
19   extraroutes << "www-master.debian.org:\t\twolkenstein.debian.org"
20   extraroutes << "tracker.debian.org:\t\tticharich.debian.org"
21   extraroutes << "salsa.debian.org:\t\tgodard.debian.org"
22 end
23
24 mxregex = Regexp.new('^\d+\s+(.*?)\.?$')
25 scope.lookupvar('deprecated::allnodeinfo').keys.sort.each do |host|
26   next unless scope.lookupvar('deprecated::allnodeinfo')[host]['mXRecord']
27   scope.lookupvar('deprecated::allnodeinfo')[host]['mXRecord'].each do |mx|
28     mxmatch = mxregex.match(mx)
29     if mxmatches.include?(mxmatch[1])
30       route = host + ":\t\t" + host
31       if scope.lookupvar('deprecated::localinfo').has_key?(host) and scope.lookupvar('site::localinfo')[host].has_key?('mail_port') and scope.lookupvar('site::localinfo')[host]['mail_port'].to_s != ''
32         route += "::" + scope.lookupvar('deprecated::localinfo')[host]['mail_port'].to_s
33       end
34       routes << route
35     end
36   end
37 end
38
39 routes << extraroutes
40
41 routes.join("\n")
42 %>