pvl.hosts.zone: test and fix alias=
authorTero Marttila <tero.marttila@aalto.fi>
Wed, 25 Feb 2015 14:56:59 +0200
changeset 466 ad9d512ec1e7
parent 465 133f14810eb5
child 467 3bb00e5e79d3
pvl.hosts.zone: test and fix alias=
pvl/hosts/tests.py
pvl/hosts/zone.py
--- a/pvl/hosts/tests.py	Wed Feb 25 14:54:24 2015 +0200
+++ b/pvl/hosts/tests.py	Wed Feb 25 14:56:59 2015 +0200
@@ -141,6 +141,22 @@
             ('1.0.2.0.0.0.0.c.0.0.0.0.0.0.0.0', 'PTR'): ['host.domain.'],
         })
     
+    def testHostAlias(self):
+        h = host.Host.build('host', 'domain',
+                ip      = '192.0.2.1',
+                alias   = 'test *.test',
+        )
+
+        self.assertEquals(h.alias, ['test', '*.test'])
+
+        self.assertZoneEquals(zone.host_forward(h, 'domain'), {
+            ('host', 'A'): ['192.0.2.1'],
+            ('test', 'CNAME'): ['host'],
+            ('*.test', 'CNAME'): ['host'],
+        })
+
+    # TODO: forward=... with alias=
+
     def testHostDelegateForward(self):
         h = host.Host.build('host', 'example.com',
                 forward = 'host.example.net',
--- a/pvl/hosts/zone.py	Wed Feb 25 14:54:24 2015 +0200
+++ b/pvl/hosts/zone.py	Wed Feb 25 14:56:59 2015 +0200
@@ -75,7 +75,7 @@
 
         yield pvl.dns.ZoneRecord.CNAME(resolve(origin, location_domain, location_alias), label)
 
-    for alias in host.alias4:
+    for alias in host.alias:
         yield pvl.dns.ZoneRecord.CNAME(resolve(origin, host.domain, alias), label)
 
     for alias in host.alias4: