Index: trunk/debs/wikimedia-task-dns-auth/gen-zones |
— | — | @@ -8,6 +8,7 @@ |
9 | 9 | templatedir = '/etc/powerdns/templates' |
10 | 10 | zonedir = '/etc/powerdns/zones' |
11 | 11 | langlist = '/etc/powerdns/langlist-cnames' |
| 12 | +domainmaplist = '/etc/powerdns/domain-maplist' |
12 | 13 | dblist = '/etc/powerdns/dblist-cnames' |
13 | 14 | |
14 | 15 | header = '''; WARNING! |
— | — | @@ -22,11 +23,24 @@ |
23 | 24 | def fillsubsts(): |
24 | 25 | import time |
25 | 26 | |
26 | | - global substs, langlist |
| 27 | + global substs, langlist, domainmaplist |
27 | 28 | |
28 | | - # $langlist contains a list of CNAMES to the geodns record for |
| 29 | + # domainmaplist is a file with format: |
| 30 | + # <var>:<domainname> |
| 31 | + # For instance: |
| 32 | + # $langlist_wikimedia:wikimedia-lb.wikimedia.org. |
| 33 | + domainmap = open(domainmaplist) |
| 34 | + domainlist = {} |
| 35 | + for map in domainmap: |
| 36 | + var, value = map.split(':') |
| 37 | + domainlist[var] = value |
| 38 | + |
| 39 | + # All substs[var] in this loop contain a list of CNAMES to the geodns record for |
29 | 40 | # all language subdomains |
30 | | - substs['$langlist'] = open(langlist).read() |
| 41 | + for var, value in domainlist.itervalues(): |
| 42 | + list = open(langlist).read() |
| 43 | + list = list.replace('$cnamedomain', value) |
| 44 | + substs[var] = list |
31 | 45 | |
32 | 46 | substs['$toolserverdbs'] = open(dblist).read() |
33 | 47 | |
Index: trunk/debs/wikimedia-task-dns-auth/gen-langlist-cnames |
— | — | @@ -8,6 +8,6 @@ |
9 | 9 | LANGLIST=$POWERDNSDIR/langlist |
10 | 10 | LANGLISTSOURCE="" |
11 | 11 | |
12 | | -[ $LANGLIST -nt $POWERDNSDIR/langlist-cnames ] && < $LANGLIST awk '{ print $1"\t\t\t1H\tIN CNAME\ttext.wikimedia.org."; print"www."$1"\t\t\t1H\tIN CNAME\ttext.wikimedia.org."; print $1".m\t\t\t1H\tIN CNAME\tm.wikimedia.org." }' > $POWERDNSDIR/langlist-cnames |
| 12 | +[ $LANGLIST -nt $POWERDNSDIR/langlist-cnames ] && < $LANGLIST awk '{ print $1"\t\t\t1H\tIN CNAME\t\$cnamedomain"; print"www."$1"\t\t\t1H\tIN CNAME\t\$cnamedomain"; print $1".m\t\t\t1H\tIN CNAME\tm.wikimedia.org." }' > $POWERDNSDIR/langlist-cnames |
13 | 13 | |
14 | 14 | exit 0 |