pvl.hosts.zone: should be an fqdn
authorTero Marttila <tero.marttila@aalto.fi>
Thu, 26 Feb 2015 16:08:58 +0200
changeset 497 0082d2092d1f
parent 496 530f22575889
child 498 d472f2eb266b
pvl.hosts.zone: should be an fqdn
pvl/hosts/tests.py
pvl/hosts/zone.py
--- a/pvl/hosts/tests.py	Thu Feb 26 16:05:26 2015 +0200
+++ b/pvl/hosts/tests.py	Thu Feb 26 16:08:58 2015 +0200
@@ -252,8 +252,15 @@
                     ip      = '192.0.2.3',
                 ),
         ]
+                
+        rrs = zone.apply_hosts_forward(hosts, 'domain', add_origin=True)
+    
+        # handle the $ORIGIN directive
+        rd = next(rrs)
 
-        self.assertZoneEquals(zone.apply_hosts_forward(hosts, 'domain'), {
+        self.assertEquals(unicode(rd), '$ORIGIN\tdomain.')
+
+        self.assertZoneEquals(rrs, {
             ('foo', 'A'): ['192.0.2.1'],
             ('foo', 'AAAA'): ['2001:db8::c000:201'],
             ('test', 'CNAME'): ['foo'],
--- a/pvl/hosts/zone.py	Thu Feb 26 16:05:26 2015 +0200
+++ b/pvl/hosts/zone.py	Thu Feb 26 16:08:58 2015 +0200
@@ -132,7 +132,7 @@
     """
 
     if add_origin:
-        yield pvl.dns.ZoneDirective.build(None, 'ORIGIN', origin)
+        yield pvl.dns.ZoneDirective.build(None, 'ORIGIN', pvl.dns.fqdn(origin))
 
     by_name = dict()
     by_name_type = dict()