Commit 709cbada authored by Evan Hunt's avatar Evan Hunt
Browse files

change the zone master file parser to a python class, "MasterFile"


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1265 e5f2f494-b856-4b98-b285-d166d9295462
parent 48cd762d
......@@ -17,7 +17,7 @@
import sys; sys.path.append ('@@PYTHONPATH@@')
import re, getopt
import isc.auth
import isc.auth.master
from isc.auth.master import MasterFile
#########################################################################
# usage: print usage note and exit
......@@ -58,19 +58,19 @@ def main():
zonefile = args[0]
try:
zf = isc.auth.master.openzone(zonefile, initial_origin)
master = MasterFile(zonefile, initial_origin)
except Exception as e:
print("Error reading zone file: " + str(e))
exit(1)
try:
zone = isc.auth.master.zonename(zf, initial_origin)
zone = master.zonename()
except Exception as e:
print("Error reading zone file: " + str(e))
exit(1)
try:
isc.auth.sqlite3_ds.load(dbfile, zone, isc.auth.master.zonedata, zf)
isc.auth.sqlite3_ds.load(dbfile, zone, master.zonedata)
except Exception as e:
print("Error loading database: " + str(e))
exit(1)
......
This diff is collapsed.
......@@ -119,9 +119,10 @@ def reverse_name(name):
# input:
# dbfile: the sqlite3 database fileanme
# zone: the zone origin
# zonedata: an iterable set of name/ttl/class/rrtype/rdata-text tuples
# reader: an generator function producing an iterable set of
# name/ttl/class/rrtype/rdata-text tuples
#########################################################################
def load(dbfile, zone, reader, file):
def load(dbfile, zone, reader):
conn, cur = open(dbfile)
old_zone_id = get_zoneid(zone, cur)
......@@ -130,7 +131,7 @@ def load(dbfile, zone, reader, file):
new_zone_id = cur.lastrowid
try:
for name, ttl, rdclass, rdtype, rdata in reader(file):
for name, ttl, rdclass, rdtype, rdata in reader():
sigtype = ''
if rdtype.lower() == 'rrsig':
sigtype = rdata.split()[0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment