I am renewing my interest in YoDNSConf, and this time I’m again looking to create a command line interface to a DNS database, as well as directly parse zone files via Ruby’s zonefile gem.
I hope to have it operate ghost, the rubygem that makes it sort of easy to manipulate one’s /etc/hosts file.
Ghost works in harmony with the trend in commands and sub-commands issued on the command line. Joey Hess describes the trend well in his post: command composition.
Perhaps the yodnsconf gem could work something like this:
yodns list example.com +-----------------------+------+-------+------+ | zone | type | ttl | name | +-----------------------+------+-------+------+ | www-c.evenserver.com. | IN | 28800 | www | | www-b.evenserver.com. | IN | 14400 | www2 | +-----------------------+------+-------+------+
It should be able to access a dotfile for settings, and be able to do some globbing, as well. I’m torn about how it should, or could do some caching of the zonefiles, to either a database (like a sqlite3 db), or to a json file, or something similar.
I’ve spent a couple hours on this and its actually working already. Awesome!
Next Steps
I’m planning on including grit for git / ruby revision control, and I’d really like to make the process much more interactive.
So far I am using Trollop, and its working very well. The DSL is a little clunky; seems like I have a lot of “Trollop::options” in my code:
cmd_opts = Trollop::options do
opt :type, "Record type", :default => 'a', :short => '-t'
end
UPDATE: I’ve created a github repo for this. NOTE: Its still alpha.
