# HG changeset patch # User Tero Marttila # Date 1387732860 -7200 # Node ID 23b3c066118911fbab1e1442ca3b1f62f0025c19 # Parent edaa5d0aa57d47cc3b471903e9d1816cd252ec38 pvl.hosts: handle fqdn hosts correctly as not having a domain diff -r edaa5d0aa57d -r 23b3c0661189 bin/pvl.hosts-dns --- a/bin/pvl.hosts-dns Sun Dec 22 19:03:57 2013 +0200 +++ b/bin/pvl.hosts-dns Sun Dec 22 19:21:00 2013 +0200 @@ -38,11 +38,14 @@ label = pvl.dns.join(host, host.domain) elif host.domain == origin : label = str(host) - elif host.domain.endswith('.' + origin) : + elif host.domain and host.domain.endswith('.' + origin) : fqdn = pvl.dns.join(host, host.domain) label = fqdn[:(len(fqdn) - len(origin) - 1)] + elif host.domain : + log.debug("%s: domain %s out of zone: %s", host, host.domain, origin) + continue else : - log.debug("%s: domain %s out of zone: %s", host, host.domain, origin) + log.debug("%s: fqdn out of zone: %s", host, origin) continue if host.forward is None : diff -r edaa5d0aa57d -r 23b3c0661189 pvl/hosts.py --- a/pvl/hosts.py Sun Dec 22 19:03:57 2013 +0200 +++ b/pvl/hosts.py Sun Dec 22 19:21:00 2013 +0200 @@ -60,15 +60,15 @@ if domain : log.debug("%s: explicit domain: %s", host, domain) + elif '.' in host : + log.debug("%s: using as fqdn without domain", host) + domain = None elif options.hosts_domain : log.debug("%s: default domain to --hots-domain: %s", host, options.hosts_domain) domain = options.hosts_domain elif section : log.debug("%s: default domain to section: %s", host, section) domain = section - elif '.' in host : - log.debug("%s: using as fqdn without domain", host) - domain = None else : raise ValueError("%s: no domain given" % (host, ))