--- a/pvl/dns/process.py Tue Mar 03 12:09:22 2015 +0200
+++ b/pvl/dns/process.py Tue Mar 03 12:14:22 2015 +0200
@@ -35,30 +35,28 @@
else:
yield rr
-def zone_includes_path (rrs, includes_path):
+def zone_includes (rrs, includes_path,
+ include_trace=None,
+):
"""
Rewrite include paths in zones.
+
+ include_trace - append included paths to given list
"""
for rr in rrs:
if isinstance(rr, zone.ZoneDirective) and rr.directive == 'INCLUDE':
include_path, = rr.arguments
- yield zone.ZoneDirective.INCLUDE(os.path.join(includes_path, include_path))
+ include = os.path.join(includes_path, include_path)
+
+ if include_trace is not None:
+ include_trace.append(include)
+
+ yield zone.ZoneDirective.INCLUDE(include)
else:
yield rr
-def zone_includes (rrs):
- """
- Extract $INCLUDE paths from zone.
- """
-
- for rr in rrs:
- if isinstance(rr, pvl.dns.ZoneDirective) and rr.directive == 'INCLUDE':
- include_path, = rr.arguments
-
- yield include_path
-
def apply_zone_output (options, zone):
"""
Output given ZoneDirective/ZoneRecord items to the output file/stdout.