--- a/bin/pvl.hosts-import Tue Dec 17 10:44:14 2013 +0200
+++ b/bin/pvl.hosts-import Tue Dec 17 10:53:42 2013 +0200
@@ -227,7 +227,7 @@
elif boot_filename :
yield hostname, 'boot', "{filename}".format(filename=boot_filename)
-def import_dhcp_hosts (options, blocks) :
+def import_dhcp_hosts (options, file_name, blocks) :
"""
Process hosts from a parsed block
"""
@@ -237,21 +237,21 @@
block, args = block[0], block[1:]
if block == 'group' :
- log.info("group")
- for info in import_dhcp_hosts(options, blocks) :
+ log.info("%s: group", file_name)
+ for info in import_dhcp_hosts(options, file_name, blocks) :
yield info
elif block == 'host' :
host, = args
- log.info("host: %s", host)
+ log.info("%s: host: %s", file_name, host)
try :
for info in import_dhcp_host(options, host, items) :
yield info
except ValueError as error :
- log.exception("%s: invalid host: %s", host, error)
+ log.exception("%s: invalid host %s: %s", file_name, host, error)
else:
- log.warn("ignore unknown block: %s", block)
+ log.warn("%s: ignore unknown block: %s", file_name, block)
def import_dhcp_conf (options, file) :
items, blocks = pvl.dhcp.config.DHCPConfigParser().load(file)
@@ -266,7 +266,7 @@
else :
log.warn("ignore unknown item: %s", item)
- for info in import_dhcp_hosts(options, blocks) :
+ for info in import_dhcp_hosts(options, file.name, blocks) :
yield info
ZONE_COMMENTS = (