equal
deleted
inserted
replaced
2 |
2 |
3 import pvl.args |
3 import pvl.args |
4 import pvl.hosts |
4 import pvl.hosts |
5 import pvl.dns.zone |
5 import pvl.dns.zone |
6 |
6 |
7 import fnmatch |
|
8 import ipaddr |
7 import ipaddr |
9 import logging; log = logging.getLogger('pvl.hosts-dns') |
8 import logging; log = logging.getLogger('pvl.hosts-dns') |
10 import optparse |
9 import optparse |
11 |
10 |
12 def process_hosts_alias (options, origin, host_domain, alias, host) : |
11 def process_hosts_alias (options, origin, host_domain, alias, host) : |
33 """ |
32 """ |
34 |
33 |
35 for host in hosts : |
34 for host in hosts : |
36 # determine label within zone |
35 # determine label within zone |
37 if not origin : |
36 if not origin : |
38 label = pvl.dns.join(host, host.domain) |
37 label = pvl.dns.join(host.name, host.domain) |
39 elif host.domain == origin : |
38 elif host.domain == origin : |
40 label = str(host) |
39 label = host.name |
41 elif host.domain and host.domain.endswith('.' + origin) : |
40 elif host.domain and host.domain.endswith('.' + origin) : |
42 fqdn = pvl.dns.join(host, host.domain) |
41 fqdn = pvl.dns.join(host.name, host.domain) |
43 label = fqdn[:(len(fqdn) - len(origin) - 1)] |
42 label = fqdn[:(len(fqdn) - len(origin) - 1)] |
44 elif host.domain : |
43 elif host.domain : |
45 log.debug("%s: domain %s out of zone: %s", host, host.domain, origin) |
44 log.debug("%s: domain out of zone: %s", host, origin) |
46 continue |
45 continue |
47 else : |
46 else : |
48 log.debug("%s: fqdn out of zone: %s", host, origin) |
47 log.debug("%s: fqdn out of zone: %s", host, origin) |
49 continue |
48 continue |
50 |
49 |