dnszone
Overview
This package is forked from Easyzone, created by Chris Miles. I have forked it to include bugfixes for installation and also to update the package for compatibility with Python 3.
DNSZone is a package to manage the common record types of a zone file, including SOA records. This module sits on top of the dnspython package and provides a higher level abstraction for common zone file manipulation use cases.
Main features:
- A high-level abstraction on top of dnspython.
- Load a zone file into objects.
- Modify/add/delete zone/record objects.
- Save back to zone file.
- Auto-update serial (if necessary).
Websites:
Requirements
Build/Test/Install
Build::
$ python setup.py build
Test::
$ python setup.py test
Install::
$ python setup.py install
OR with setuptools::
$ easy_install dnszone
Examples
dnszone::
>>> from dnszone import dnszone
>>> z = dnszone.zone_from_file('example.com', '/var/namedb/example.com')
>>> z.domain
'example.com.'
>>> z.root.soa.serial
2007012902L
>>> z.root.records('NS').items
['ns1.example.com.', 'ns2.example.com.']
>>> z.root.records('MX').items
[(10, 'mail.example.com.'), (20, 'mail2.example.com.')]
>>> z.names['foo.example.com.'].records('A').items
['10.0.0.1']
>>> ns = z.root.records('NS')
>>> ns.add('ns3.example.com.')
>>> ns.items
['ns1.example.com.', 'ns2.example.com.', 'ns3.example.com.']
>>> ns.delete('ns2.example.com')
>>> ns.items
['ns1.example.com.', 'ns3.example.com.']
>>> z.save(autoserial=True)
ZoneCheck::
>>> from dnszone.zone_check import ZoneCheck
>>> c = ZoneCheck()
>>> c.isValid('example.com', '/var/named/zones/example.com')
True
>>> c.isValid('foo.com', '/var/named/zones/example.com')
False
>>> c.error
'Bad syntax'
>>>
>>> c = ZoneCheck(checkzone='/usr/sbin/named-checkzone')
>>> c.isValid('example.com', '/var/named/zones/example.com')
True
>>>
ZoneReload::
>>> from dnszone.zone_reload import ZoneReload
>>> r = ZoneReload()
>>> r.reload('example.com')
zone reload up-to-date
>>> r.reload('foo.com')
rndc: 'reload' failed: not found
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "dnszone/zone_reload.py", line 51, in reload
raise ZoneReloadError("rndc failed with return code %d" % r)
dnszone.zone_reload.ZoneReloadError: rndc failed with return code 1
>>>
>>> r = ZoneReload(rndc='/usr/sbin/rndc')
>>> r.reload('example.com')
zone reload up-to-date
>>>
Release files for dnszone 3.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dnszone-3.1.1.tar.gz | 14.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dnszone-3.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.0 kB
Release files / dnszone-3.1.1.tar.gz
| Download URL | dnszone-3.1.1.tar.gz |
|---|---|
| Size | 14.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ecc12d4af83fde172f6dc827362bc1d4c0c49fd100a53443adc5c15a54a0841
|
|
BLAKE2b-256 checksum How to use checksums |
94600c49901976e8d168aa979eb177b38516097a79ffdb31124e2290e88ce7ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.4
|
Release files / dnszone-3.1.1-py3-none-any.whl
| Download URL | dnszone-3.1.1-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cbdbd5c2eebbb8cfde7517107ee2ad8a016e7b0fa7db12a232b0e0bcd76518c2
|
|
BLAKE2b-256 checksum How to use checksums |
517987c1cd5cfb3cbe73d2747fb79bd713bdbc915ac077ed15953697704da4d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.4
|