--- a/pvl/hosts/host.py Wed Feb 25 15:09:51 2015 +0200
+++ b/pvl/hosts/host.py Wed Feb 25 15:12:55 2015 +0200
@@ -39,12 +39,12 @@
else:
return ()
-def parse_location(value, domain):
+def parse_location(location, domain):
"""
Parse location@domain.
"""
- if not value:
+ if not location:
return None
if '@' in location:
@@ -148,7 +148,7 @@
ethernet - { index: ethernet }
alias - [ str ]: generate CNAMEs for given relative names
owner - str: LDAP uid
- location - location (name, domain) or None
+ location - None or (name, domain)
alias4 - [ str ]: generate additional A records for given relative names
alias6 - [ str ]: generate additional AAAA records for given relative names
forward - None: generate forward zone A/AAAA records per ip/ip6
--- a/pvl/hosts/tests.py Wed Feb 25 15:09:51 2015 +0200
+++ b/pvl/hosts/tests.py Wed Feb 25 15:12:55 2015 +0200
@@ -212,6 +212,19 @@
('test', 'CNAME'): ['host'],
})
+ def testHostLocation(self):
+ h = host.Host.build('host', 'domain',
+ ip = '192.0.2.1',
+ location = 'test',
+ )
+
+ self.assertEquals(h.location, ('test', 'domain'))
+
+ self.assertZoneEquals(zone.host_forward(h, 'domain'), {
+ ('host', 'A'): ['192.0.2.1'],
+ ('test', 'CNAME'): ['host'],
+ })
+
class TestReverseZone(TestZoneMixin, unittest.TestCase):
def setUp(self):
self.options = Options()
--- a/pvl/hosts/zone.py Wed Feb 25 15:09:51 2015 +0200
+++ b/pvl/hosts/zone.py Wed Feb 25 15:12:55 2015 +0200
@@ -74,9 +74,6 @@
if host.location:
location_alias, location_domain = host.location
- if not location_domain:
- location_domain = host.domain
-
yield pvl.dns.ZoneRecord.CNAME(resolve(origin, location_domain, location_alias), label)
for alias in host.alias: