pvl.hosts.zone: better errors for host forward rr conflicts
authorTero Marttila <tero.marttila@aalto.fi>
Mon, 02 Mar 2015 13:12:35 +0200
changeset 686 6416c448a713
parent 685 668f934bb958
child 687 f99f9e3d02cf
pvl.hosts.zone: better errors for host forward rr conflicts
pvl/hosts/zone.py
--- a/pvl/hosts/zone.py	Mon Mar 02 12:59:17 2015 +0200
+++ b/pvl/hosts/zone.py	Mon Mar 02 13:12:35 2015 +0200
@@ -140,14 +140,14 @@
     for host in hosts:
         for rr in host_forward(host, origin) :
             if (rr.name, 'CNAME') in by_name_type:
-                raise HostZoneError(host, "CNAME {cname} conflict: {rr}".format(cname=by_name_type[rr.name, 'CNAME'].name, rr=rr))
+                raise HostZoneError(host, u"{cname} CNAME conflict with {other}".format(cname=rr.name, other=by_name_type[rr.name, 'CNAME']))
             elif rr.type == 'CNAME' and rr.name in by_name:
-                raise HostZoneError(host, "CNAME {cname} conflict: {rr}".format(cname=rr.name, rr=by_name[rr.name]))
+                raise HostZoneError(host, u"{cname} CNAME conflict with {other}".format(cname=rr.name, other=by_name[rr.name]))
             elif (rr.name, rr.type) in by_name_type:
-                raise HostZoneError(host, "{type} {name} conflict: {rr}".format(type=rr.type, name=rr.name, rr=by_name_type[rr.name, rr.type]))
+                raise HostZoneError(host, u"{name} {type} conflict with {other}".format(type=rr.type, name=rr.name, other=by_name_type[rr.name, rr.type]))
             
-            by_name[rr.name] = rr
-            by_name_type[rr.name, rr.type] = rr
+            by_name[rr.name] = host
+            by_name_type[rr.name, rr.type] = host
             
             # preserve ordering
             yield rr