Dear all,
I am trying to create a new zone file with dnspython library, but I
encountered many difficulties to create it. Please see the following
extract from my code:
[...]
l_soaname = dns.name.Name(soaname.split("."))
l_rname = dns.name.Name(rname.split(".") )
l_file = tempfile.NamedTemporaryFile(mode="w",suffix=zonename,
prefix="db.", dir="/usr/local/Strogoff-NG/db/zones/")
l_zone = dns.zone.from_file( l_file.name, check_origin=False )
l_rdataset = l_zone.find_rdataset("@",rdtype="SOA",create=True)
l_rdata = dns.rdtypes.ANY.SOA.SOA( dns.rdataclass.from_text("IN"),
dns.rdatatype.from_text("SOA"), l_soaname, l_rname, 100, 200, 300, 400,
500 )
l_rdataset.add( l_rdata, ttl=600 )
l_zone.to_file(l_pathzonefile)
I create a tempfile, because the zone file doesn't existing and I need a
zone object for my treatment. The l_soaname and l_rname are splitted
because into dns.rdtypes.ANY.SOA.SOA a dns.name.Name is required and
dns.name.Name required an iterable object ( here a list ). It works but
the final result is not compliant, below the head of zonefile:
@ 600 IN SOA my.domain.net hostmaster\@my.domain.net 100 200 300
400 500
Normally:
- the soa name is: my.domain.net.
- the rname is: hostmaster.my.domain.net.
The final dot is missing and in the rname the "@" is present. Do you
have any idea to create a compliant dns zone?
Best Regards,
Michael.
_______________________________________________
dnspython-users mailing list
[email protected]
http://howl.play-bow.org/mailman/listinfo.cgi/dnspython-users