Package: tonicdnscli
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.RequirementsPython 2.7 or Python 3.2 later.Setup$ git clone https://github.com/mkouhei/tonicdnscli
$ cd tonicdnscli
$ sudo python setup.py installUsageInput 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 3600Setting default options to config fileAn alternative method of command options that use the config file.
Copy examples/tdclirc.sample to$HOME/.tdclirc.passwordkey to set password in plain text, it is recommended that you remove this line,-Poption is used.:[global]
server: ns.example.org

[auth]
username: tonicuser
password: tonicpwPrint converted JSONConvert to JSON and print.:$ tonicdnscli show sample/example.org.txt
{
  "records": [
    {
      "content": "10.10.10.10",
      "name": "test0.example.org",
      "ttl": "86400",
      "type": "A"
    },
    {
      "content": "10.10.10.11",
      "name": "test1.example.org",
      "ttl": "86400",
      "type": "A"
    },
    {
      "content": "10.10.10.12",
      "name": "test2.example.org",
      "ttl": "86400",
      "type": "A"
    },
(snip)Retrieve all zonesGet all zones and print.:$ tonicdnscli get -u tonicusername -P
+-------------+--------+-----------------+
| name        | type   | notified_serial |
+-------------+--------+-----------------+
| example.org | MASTER | 2012052201      |
| example.net | MASTER | 2012060502      |
+-------------+--------+-----------------+Retrieve recordsGet 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 recordCreate 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
trueCreate recordsCreate multi records with specific zone.:$ tonicdnscli bulk_create -s ns.example.org -u tonicusername -P examples/example.org.txt
trueUpdate single recordUpdate 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 recordsDelete 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
trueDelete recordsDelete multi records with specific zone.:$ tonicdnscli bulk_delete -s ns.example.org -u tonicusername -P examples/example.org.txt
trueUpdate SOAUpdate 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: TrueCreate zone for MASTERMaster DNS server IP address with–dnsaddroption.:$ tonicdnscli zone_create -s ns.example.org -u tonicusername -P --domain example.net --dnsaddr 192.168.0.100
true
true
trueCreate zone for SLAVERequire-Soption.:$ 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 NATIVERequire-Noption.:$ 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 zoneDelete specific zone.:$ tonicdnscli zone_delete -s ns.example.org -u tonicusername -P --domain example.com
trueRetrieve templatesGet 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 templateDelete specific template.:$ tonicdnscli tmpl_delete -s ns.example.org -u tonicusername -P --template example_com
trueContributeFirstly copy pre-commit hook script.:$ cp -f utils/pre-commit.txt .git/hooks/pre-commitNext install python2.7 later, and py.test. Below in Debian GNU/Linux Sid system,:$ sudo apt-get install python python-pytestThen checkout ‘devel’ branch for development, commit your changes. Before pull request, execute git rebase.See alsoTonicDNSPowerDNSToDoFeaturesChecking existing records When create or delete records.Validation input data.ImprovementAdd unittest.Change minimock to Mock for being compatible Python2.7 and Python3.2.Check specifying priority with creating MX|SRV record.Known bugWhen using in preference –config option than $HOME/.tdclirc.History0.10 (2013-04-01)Change format of pretty printmove test directory0.9 (2012-09-13)Refine searchUpdate single record0.8.4 (2012-09-12)Fix typo0.8.3 (2012-09-12)Fix bug local variable ‘auto_update_soa’ referenced before assignment without update_soa flag0.8.2 (2012-09-11)Fix bug local variable ‘auto_update_soa’ referenced before assignment0.8.1 (2012-09-11)Add updating SOA serial automaticallyFix travic-ci runnning error of test_pep8RefacotoringChange method nameRemove unnecessary method, module0.8 (2012-07-08)Add Creating zoneSub-command ‘zone_create’Support MASTER, SLAVE, NATIVEexecute next process:creating templatecreating zonedeleting templateRemove template_create_update sub-commandAdd Deleting zoneSub-command ‘zone_delete’Add options of soa sub-commandAdd option ‘–domain’ to bulk_create, bulk_delete sub-commands0.7.1 (2012-06-29)Fix bug module importFix bug that assert is always true of test_pep80.7 (2012-06-29)Add default timeoutUpdate unit testsTool of adding user account of TonicDNS0.6.2 (2012-06-17)New feature of getting all zonesAdd pre-commit hook scriptRename method name that test_getJSON to test_setJSONRefactoring of http connect0.6.1.1 (2012-05-23)Fix README0.6.1 (2012-05-23)Fix issue#2Refactoring0.6 (2012-05-15)Update SOA0.5.2 (2012-05-11)create or delete a specific record0.5.1 (2012-05-07)Fix bug get fail when resolver is SLAVE0.5 (2012-05-04)templates CRUD0.4.4 (2012-05-01)not distribute util3.py (alternative print for python3)0.4.3 (2012-05-01)search target conent and typeretrieve all zone0.4.2 (2012-04-28)Add search recordsFormat of stdout of retrieve records0.4.1 (2012-04-27)Fix bug processing last data only, when separate file0.4 (2012-04-26)default option config file $HOME/.tdclirc0.3.2 (2012-04-25)Add unittest of pep8, converter.py, tdauth.py (partially)Add exception error handlingRefactoring (Thanks Henrich)0.3.1 (2012-04-23)Add manpage0.3 (2012-04-21)New command line style, add sub-command, change optionsChange optparse to argparsenew sub-command : show|get|create|delete0.2 (2012-04-20)Support Python3Add option-Pas password prompt with echo turned off0.1 (2012-04-20)first release