138 by_name_type = dict() |
138 by_name_type = dict() |
139 |
139 |
140 for host in hosts: |
140 for host in hosts: |
141 for rr in host_forward(host, origin) : |
141 for rr in host_forward(host, origin) : |
142 if (rr.name, 'CNAME') in by_name_type: |
142 if (rr.name, 'CNAME') in by_name_type: |
143 raise HostZoneError(host, "CNAME {cname} conflict: {rr}".format(cname=by_name_type[rr.name, 'CNAME'].name, rr=rr)) |
143 raise HostZoneError(host, u"{cname} CNAME conflict with {other}".format(cname=rr.name, other=by_name_type[rr.name, 'CNAME'])) |
144 elif rr.type == 'CNAME' and rr.name in by_name: |
144 elif rr.type == 'CNAME' and rr.name in by_name: |
145 raise HostZoneError(host, "CNAME {cname} conflict: {rr}".format(cname=rr.name, rr=by_name[rr.name])) |
145 raise HostZoneError(host, u"{cname} CNAME conflict with {other}".format(cname=rr.name, other=by_name[rr.name])) |
146 elif (rr.name, rr.type) in by_name_type: |
146 elif (rr.name, rr.type) in by_name_type: |
147 raise HostZoneError(host, "{type} {name} conflict: {rr}".format(type=rr.type, name=rr.name, rr=by_name_type[rr.name, rr.type])) |
147 raise HostZoneError(host, u"{name} {type} conflict with {other}".format(type=rr.type, name=rr.name, other=by_name_type[rr.name, rr.type])) |
148 |
148 |
149 by_name[rr.name] = rr |
149 by_name[rr.name] = host |
150 by_name_type[rr.name, rr.type] = rr |
150 by_name_type[rr.name, rr.type] = host |
151 |
151 |
152 # preserve ordering |
152 # preserve ordering |
153 yield rr |
153 yield rr |
154 |
154 |
155 def apply_hosts_reverse (hosts, prefix, |
155 def apply_hosts_reverse (hosts, prefix, |