def main(): parser = argparse.ArgumentParser( description='Extract zonefiles from named.conf.') parser.add_argument('named_conf', metavar='FILE', type=str, nargs=1, help='the named.conf to parse') parser.add_argument('-w', '--write', metavar='DIR', type=str, help='Wwrite each extracted zonefile as its own file' ' in DIR') parser.add_argument('-v', '--verbose', action='store_true', help='verbose output') args = parser.parse_args() if args.verbose: LOG.setLevel(logging.INFO) else: LOG.setLevel(logging.WARNING) try: x = Extractor(args.named_conf[0]) for zone in x.extract(): if args.write is not None: zone.to_file(args.write) else: zone.to_stdout() except IOError as e: LOG.error(e)
def main(): parser = argparse.ArgumentParser(description="Extract zonefiles from named.conf.") parser.add_argument("named_conf", metavar="FILE", type=str, nargs=1, help="the named.conf to parse") parser.add_argument( "-w", "--write", metavar="DIR", type=str, help="Wwrite each extracted zonefile as its own file" " in DIR" ) parser.add_argument("-v", "--verbose", action="store_true", help="verbose output") args = parser.parse_args() if args.verbose: LOG.setLevel(logging.INFO) else: LOG.setLevel(logging.WARNING) try: x = Extractor(args.named_conf[0]) for zone in x.extract(): if args.write is not None: zone.to_file(args.write) else: zone.to_stdout() except IOError as e: LOG.error(e)
def main(): parser = argparse.ArgumentParser( description='Extract zonefiles from named.conf.') parser.add_argument('named_conf', metavar='FILE', type=str, nargs=1, help='the named.conf to parse') parser.add_argument('-w', '--write', metavar='DIR', type=str, help='Wwrite each extracted zonefile as its own file' ' in DIR') parser.add_argument('-v', '--verbose', action='store_true', help='verbose output') args = parser.parse_args() if args.verbose: LOG.setLevel(logging.INFO) else: LOG.setLevel(logging.WARNING) try: x = Extractor(args.named_conf[0]) for zone in x.extract(): if args.write is not None: zone.to_file(args.write) else: zone.to_stdout() except IOError as e: LOG.error(e)