Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install tonicdnscli

How to install tonicdnscli

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install tonicdnscli
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.7.1
0.10Never BuiltWhy not?
0.7.1 Available View build log
0.6.1.1 Available View build log
Windows (64-bit)
0.6.1.1
0.10Never BuiltWhy not?
0.6.1.1 Available View build log
Mac OS X (10.5+)
0.7.1
0.10Never BuiltWhy not?
0.7.1 Available View build log
0.6.1.1 Available View build log
Linux (32-bit)
0.10 Available View build log
0.7.1 Available View build log
0.7 Available View build log
0.6.1.1 Available View build log
Linux (64-bit)
0.10 Available View build log
0.7.1 Available View build log
0.7 Available View build log
0.6.1.1 Available View build log
 
Author
License
GNU General Public License version 3
Dependencies
Lastest release
version 0.10 on Apr 14th, 2013

This command line tool for TonicDNS API. TonicDNS is RESTful API for PowerDNS. Convert readble text record to JSON, and create or delete zone records with TonicDNS.

Requirements

  • Python 2.7 or Python 3.2 later.

Setup

$ git clone https://github.com/mkouhei/tonicdnscli
$ cd tonicdnscli
$ sudo python setup.py install

Usage

Input file (example.org.txt)

examples/example.org.txt:

# name type content ttl priority
test0.example.org A 10.10.10.10 86400
test1.example.org A 10.10.10.11 86400
test2.example.org A 10.10.10.12 86400
example.org MX mx.example.org 86400 0
example.org MX mx2.example.org 86400 10
mx.example.org A 10.10.11.10 3600
mx2.example.org A               10.10.11.10 3600
Setting default options to config file

An alternative method of command options that use the config file. Copy examples/tdclirc.sample to $HOME/.tdclirc. password key to set password in plain text, it is recommended that you remove this line, -P option is used.:

[global]
server: ns.example.org

[auth]
username: tonicuser
password: tonicpw
Retrieve all zones

Get all zones and print.:

$ tonicdnscli get -u tonicusername -P
+-------------+--------+-----------------+
| name        | type   | notified_serial |
+-------------+--------+-----------------+
| example.org | MASTER | 2012052201      |
| example.net | MASTER | 2012060502      |
+-------------+--------+-----------------+
Retrieve records

Get records of specific zone and print.:

$ tonicdnscli get -s ns.example.org -d example.org -u tonicusername -P
zone:        example.org
SOA record:  ns.example.org hostmaster.example.org 2012042403
ttl:         86400
change date: 1341314161
example.org
+------+------+-----------------+-------+------+-------------+
| name | type | content         | ttl   | prio | change date |
+------+------+-----------------+-------+------+-------------+
|      | NS   | ns.example.org  | 86400 | -    | -           |
|      | NS   | ns2.example.org | 86400 | -    | -           |
| ns.  | A    | 192.168.0.100   | 86400 | -    | -           |
| ns2. | A    | 192.168.0.101   | 86400 | -    | -           |
| www. | A    | 192.168.0.1     | 86400 | -    | -           |
+------+------+-----------------+-------+------+-------------+
Create single record

Create single record with specific zone.:

$ tonicdnscli create -s ns.example.org -u tonicusername -P \
--domain example.org --name www2.example.org --rtype A --content 10.10.10.10
true
Create records

Create multi records with specific zone.:

$ tonicdnscli bulk_create -s ns.example.org -u tonicusername -P examples/example.org.txt
true
Update single record

Update single record with specific zone.:

$ tonicdnscli update -s ns.example.org -u tonicdnsusername -P \
--domain example.org --name www2.example.org --rtype A --content 10.10.10.10 --new-content 10.10.10.11
true (<- delete record)
true (<- create record)
Delete single records

Delete single record with specific zone.:

$ tonicdnscli delete -s ns.example.org -u tonicusername -P \
--domain example.org --name www2.example.org --rtype A --content 10.10.10.11
true
Delete records

Delete multi records with specific zone.:

$ tonicdnscli bulk_delete -s ns.example.org -u tonicusername -P examples/example.org.txt
true
Update SOA

Update SOA record or speficie zone.:

$ tonicdnscli soa -s ns.example.org -u tonicusername -P --domain example.org
true (<- create record)
true (<- delete record)

If you want to update automatically, append next variable to global section of ~/.tdclirc.:

[global]
(snip)
soa_update: True
Create zone for MASTER

Master DNS server IP address with --dnsaddr option.:

$ tonicdnscli zone_create -s ns.example.org -u tonicusername -P --domain example.net --dnsaddr 192.168.0.100
true
true
true
Create zone for SLAVE

Require -S option.:

$ tonicdnscli zone_create -s ns.example.org -u tonicusername -P --domain example.net --dnsaddr 192.168.0.100 -S
true (<- create template)
true (<- create zone)
true (<- delete template)
Create zone for NATIVE

Require -N option.:

$ tonicdnscli zone_create -s ns.example.org -u tonicusername -P --domain example.net --dnsaddr 192.168.0.100 -N
true (<- create template)
true (<- create zone)
true (<- delete template)
Delete zone

Delete specific zone.:

$ tonicdnscli zone_delete -s ns.example.org -u tonicusername -P --domain example.com
true
Retrieve templates

Get tepmlates and print.:

$ tonicdnscli tmpl_get -s ns.example.org -u tonicusername -P
identifier : example_net
description:
==============================================================================
name                              type  content                   ttl   prio
example.net                       SOA
> ns.example.net hostmaster.example.net 2012070501 3600 900 86400 3600   3600
example.net                       NS    ns.example.net            3600
ns.example.net                    A     192.168.0.100             3600
==============================================================================
identifier : example2_net
description:
(snip)
Delete template

Delete specific template.:

$ tonicdnscli tmpl_delete -s ns.example.org -u tonicusername -P --template example_com
true

Contribute

Firstly copy pre-commit hook script.:

$ cp -f utils/pre-commit.txt .git/hooks/pre-commit

Next install python2.7 later, and py.test. Below in Debian GNU/Linux Sid system,:

$ sudo apt-get install python python-pytest

Then checkout 'devel' branch for development, commit your changes. Before pull request, execute git rebase.

See also

ToDo

Features
  • Checking existing records When create or delete records.
  • Validation input data.
Improvement
  • Add unittest.
  • Change minimock to Mock for being compatible Python2.7 and Python3.2.
  • Check specifying priority with creating MX|SRV record.
Known bug
  • When using in preference --config option than $HOME/.tdclirc.

History

0.10 (2013-04-01)
  • Change format of pretty print
  • move test directory
0.9 (2012-09-13)
  • Refine search
  • Update single record
0.8.4 (2012-09-12)
  • Fix typo
0.8.3 (2012-09-12)
  • Fix bug local variable 'auto_update_soa' referenced before assignment without update_soa flag
0.8.2 (2012-09-11)
  • Fix bug local variable 'auto_update_soa' referenced before assignment
0.8.1 (2012-09-11)
  • Add updating SOA serial automatically
  • Fix travic-ci runnning error of test_pep8
  • Refacotoring
    • Change method name
    • Remove unnecessary method, module
0.8 (2012-07-08)
  • Add Creating zone
    • Sub-command 'zone_create'
    • Support MASTER, SLAVE, NATIVE
    • execute next process:
      1. creating template
      2. creating zone
      3. deleting template
  • Remove template_create_update sub-command
  • Add Deleting zone
    • Sub-command 'zone_delete'
  • Add options of soa sub-command
  • Add option '--domain' to bulk_create, bulk_delete sub-commands
0.7.1 (2012-06-29)
  • Fix bug module import
  • Fix bug that assert is always true of test_pep8
0.7 (2012-06-29)
  • Add default timeout
  • Update unit tests
  • Tool of adding user account of TonicDNS
0.6.2 (2012-06-17)
  • New feature of getting all zones
  • Add pre-commit hook script
  • Rename method name that test_getJSON to test_setJSON
  • Refactoring of http connect
0.6.1.1 (2012-05-23)
  • Fix README
0.6.1 (2012-05-23)
  • Fix issue#2
  • Refactoring
0.6 (2012-05-15)
  • Update SOA
0.5.2 (2012-05-11)
  • create or delete a specific record
0.5.1 (2012-05-07)
  • Fix bug get fail when resolver is SLAVE
0.5 (2012-05-04)
  • templates CRUD
0.4.4 (2012-05-01)
  • not distribute util3.py (alternative print for python3)
0.4.3 (2012-05-01)
  • search target conent and type
  • retrieve all zone
0.4.2 (2012-04-28)
  • Add search records
  • Format of stdout of retrieve records
0.4.1 (2012-04-27)
  • Fix bug processing last data only, when separate file
0.4 (2012-04-26)
  • default option config file $HOME/.tdclirc
0.3.2 (2012-04-25)
  • Add unittest of pep8, converter.py, tdauth.py (partially)
  • Add exception error handling
  • Refactoring (Thanks Henrich)
0.3.1 (2012-04-23)
  • Add manpage
0.3 (2012-04-21)
  • New command line style, add sub-command, change options
    • Change optparse to argparse
    • new sub-command : show|get|create|delete
0.2 (2012-04-20)
  • Support Python3
  • Add option -P as password prompt with echo turned off
0.1 (2012-04-20)
  • first release

Subscribe to package updates

Last updated Apr 14th, 2013

Download Stats

Last month:4

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.