Easy Zone - DNS Zone abstraction module
Project description
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
>>>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file dnszone-2.0.2.tar.gz
.
File metadata
- Download URL: dnszone-2.0.2.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/2.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddecb65561d08fcf1c088bb9ab3acba9395c56a58ff4869fa4cb857ba6e6dfaf |
|
MD5 | 9c64067b467135add7b019c4491c0189 |
|
BLAKE2b-256 | 8dc691c70fa067bd3e1719c958bce90a19dda5d81889f5da37cfa353473cfeaf |
File details
Details for the file dnszone-2.0.2-py3-none-any.whl
.
File metadata
- Download URL: dnszone-2.0.2-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cfa4d60ea5e3e8ae25b51924b37acae09fdbc82951354f5abbb62cfa72fe7ba |
|
MD5 | 85d5f18adefa207de6383d7872d4ef20 |
|
BLAKE2b-256 | c1185adf454229f76fcfdfb48eb6841bbd11d5add6d8dcc3cde96f912bca0062 |
File details
Details for the file dnszone-2.0.2-py2-none-any.whl
.
File metadata
- Download URL: dnszone-2.0.2-py2-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/2.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9850d0bfad2c29ace9d5df8a665ef254c493cbe6edd500c1c91f6e470255bd4b |
|
MD5 | cc09a0cb7ba73cfa8c0869ed02a3856c |
|
BLAKE2b-256 | 8d7b0422541e21b37d2be674a065cb1d91e6d156298291daa29d92bdb595f0e3 |