pvl.dns-zone: remove zone meta support
authorTero Marttila <tero.marttila@aalto.fi>
Fri, 27 Feb 2015 11:53:25 +0200
changeset 636 d21df33dd1d4
parent 635 7bde9e5ce40f
child 637 6674b18f6829
pvl.dns-zone: remove zone meta support
bin/pvl.dns-zone
--- a/bin/pvl.dns-zone	Fri Feb 27 11:53:05 2015 +0200
+++ b/bin/pvl.dns-zone	Fri Feb 27 11:53:25 2015 +0200
@@ -51,16 +51,6 @@
     parser.add_option('--check-exempt',         metavar='HOST', action='append',
             help="Allow given names to have multiple records")
 
-    # meta stage
-    parser.add_option('--meta-zone',            action='store_true',
-            help="Generate host metadata zone; requires --input-line-date")
-
-    parser.add_option('--meta-ignore',          metavar='HOST', action='append',
-            help="Ignore given hostnames in metadata output")
-
-    parser.add_option('--input-line-date',      action='store_true',
-            help="Parse timestamp prefix from each input line (e.g. `hg blame | ...`)")
-
     # forward stage
     parser.add_option('--forward-zone',         action='store_true', 
             help="Generate forward zone")
@@ -89,7 +79,6 @@
     parser.set_defaults(
         # XXX: combine
         check_exempt        = [],
-        meta_ignore         = [],
     )
     
     # parse
@@ -108,9 +97,7 @@
     for file in pvl.args.apply_files(args, 'r', options.input_charset) :
         log.info("Reading zone: %s", file)
 
-        for line, record in pvl.dns.zone.ZoneLine.load(file, 
-                line_timestamp_prefix   = options.input_line_date,
-        ) :
+        for line, record in pvl.dns.zone.ZoneLine.load(file):
             yield line, record
 
 # TODO: --check-types to limit this to A/AAAA/CNAME etc
@@ -209,27 +196,6 @@
                 # XXX: is this even a good idea?
                 yield line, ZoneRecord.MX(None, 10, mx, ttl=r.ttl)
 
-def process_zone_meta (zone, ignore=None) :
-    """
-        Process zone metadata -> output.
-    """
-    
-    TIMESTAMP_FORMAT = '%Y/%m/%d'
-    
-    for line, r in zone :
-        if ignore and r.name in ignore :
-            # skip
-            log.debug("Ignore record: %s", r)
-            continue
-
-        # for hosts..
-        if r.type == 'A' :
-            # timestamp?
-            timestamp = r.line.timestamp
-
-            if timestamp :
-                yield line, ZoneRecord.TXT(r.name, timestamp.strftime(TIMESTAMP_FORMAT), ttl=r.ttl)
-     
 def process_zone_reverse (zone, origin, domain) :
     """
         Process zone data -> reverse zone data.
@@ -319,15 +285,6 @@
 
         zone = list(process_zone_forwards(zone, txt=options.forward_txt, mx=options.forward_mx))
 
-    if options.meta_zone :
-        log.info("Generate metadata zone...")
-
-        if not options.input_line_date :
-            log.error("--meta-zone requires --input-line-date")
-            return 1
-
-        zone = list(process_zone_meta(zone, ignore=set(options.meta_ignore)))
-
     if options.reverse_zone :
         if ':' in options.reverse_zone :
             # IPv6