I've failed to get a good answer from Googling or tutorials on how I can create a standard zone file using dnspython. Could someone kindly help with sample code on how I can generate the following zone file?
I've seen seen the following sample code below, but I simply don't understand some segments of it plus it doesn't exactly generate the above zone file. Thanks.
zone = dns.zone.Zone(dns.name.from_text('
example.com'))
all_data = (
('example.com.', 'SOA', ('davebeast.beast.local. david.beast.local.
2016031421 10800 3600 604800 21600',)),
('@', 'TXT', ('foo',)),
('@', 'MX', (10, 'mail')),
('@', 'A', ('1.2.3.4',)),
('mail', 'A', ('1.2.3.10',)),
)
for name, rtype, data in all_data:
print name, rtype, data
rdtype = dns.rdatatype.from_text(rtype)
stuff = ' '.join([str(x) for x in data])
n = zone.get_rdataset(name, rdtype, create=True)
n.add(rdata)