Index: trunk/debs/wikimedia-task-dns-auth/gen-zones |
— | — | @@ -31,12 +31,19 @@ |
32 | 32 | # $langlist_wikimedia:wikimedia-lb.wikimedia.org. |
33 | 33 | domainlist = {} |
34 | 34 | domainmap = open(domainmaplist) |
| 35 | + lineno=0 |
35 | 36 | for map in domainmap.readlines(): |
36 | | - if map[0] == "#": |
| 37 | + lineno = lineno + 1 |
| 38 | + map = map.strip() |
| 39 | + # skip blank lines and comments |
| 40 | + if not map or map.startswith("#"): |
37 | 41 | continue |
38 | | - map = map.strip() |
39 | | - var, value = map.split(':') |
40 | | - domainlist[var] = value |
| 42 | + try: |
| 43 | + var, value = map.split(':') |
| 44 | + except ValueError, e: |
| 45 | + print "Syntax error in %s at line %s: %s. Quitting." % (domainmaplist, lineno, e) |
| 46 | + exit(1) |
| 47 | + domainlist[var.split()] = value.split() |
41 | 48 | |
42 | 49 | # All substs[var] in this loop contain a list of CNAMES to the geodns record for |
43 | 50 | # all language subdomains |