Main»Pykt

Pykt

Pykt is a little tool written in Python that attempts to help you centrally manage configuration files for a series of hosts.

Pykt was inspired by, and named after, PIKT. PIKT is a neat looking tool, but I had two gripes:

  1. PIKT was far more complex than I needed. I basically wanted macro expansion and distribution of files.
  2. PIKT seemed somewhat fragile. I manage many hosts scattered around my side of the country, and often the only means of contacting them is over the Internet. In the process of setting up PIKT, I believe I managed to crash its client RPC server, and the code for that RPC server then struck me as very unimpressive.

So I threw PIKT out and made Pykt to do two things:

  1. Take an input file, some information about a host (akin to #defines in the C preprocessor), and output a version of the input file made specifically for that host.
  2. Distribute these files as necessary via SSH.

Pykt does these two basic things, though certainly not in the most robust way. I hacked on Pykt to make it do the bare minimum tasks I thought I needed. I do have Pykt deployed, minimally, on one or two different networks, and it's basically doing its job.

Pykt has several problems, though. Just off of the top of my head:

  • Pykt doesn't deal with hosts that aren't up very well at all. You might not realize how often the odd server or two is actually unreachable until you try to distribute files with Pykt a few times.
  • One of its configuration files is in XML, and pretty verbose XML at that. I fear writing that. (Though you'd probably be able to cook up a Perl script to generate the XML configuration file from a more friendly format in short order.)
  • Ironically, Pykt's macro language then fails to deal well with XML, using $<foo> to interpolate variables. This gives structured editors (like nXML in Emacs, for example) a fit and you might one day find yourself wanting to write $<em>4,000</em> or something weird. (Not that editing XML files with the equivalent of #ifdef is recommended anyway.)
  • The way it deals with SSH can be kind of ugly. For example, Pykt will either die or freak out if SSH prompts for a password.

These days I'm aiming at something more like what is described at infrastructures.org to manage my systems. I haven't rolled anything out yet, but I'll likely be distributing via rsync, and having the clients pull rather than push. Per-client modifications to configuration files will be made by a series of scripts that get pulled down by rsync and run regularly via cron to keep everything up to date.

I'm not developing Pykt anymore. I might make some small changes if someone requested them, but don't count on it. Still, if you want to download Pykt, be my guest.