Software Engineer

Jason Hancock

last update:

Like I mentioned in my last post, I’ve been toying with a CloudStack based private cloud. Let me try to paint a picture of what we’re trying to accomplish with cloudstack: Our dispatch software decides it needs a box of flavor ‘foo’ and calls out to the API to deploy a new box Dispatch software waits until box is up before dispatching a job to the box Dispatch software monitors running job.

Update 12/06/2011: The facter code has been updated to support Fedora and to also load the instance-id of the VM from the metadata available on the virtual router. Grab the latest from GitHub. I’ve been playing with a proof-of-concept CloudStack based cloud at work. One of the things that caught my eye was that you can associate userdata to an instance. What I wanted to do was exploit this and use the userdata to populate facts that I could then use in my Puppet manifests.

Let’s say that you wanted to have a puppet fact that contained the version number of a particular package installed on each server. For this example, let’s use the nagios’ nrpe package. I put my custom facts into a <modulepath>/custom/lib/facter/, so I’ll call it <modulepath>/custom/lib/facter/nrpe.rb. The code looks like this: require'facter'result=%x{/bin/rpm -q --queryformat "%{VERSION}-%{RELEASE}" nrpe}Facter.add('nrpe')dosetcodedoresultendend This creates a fact called ‘nrpe’ that can be accessed in your puppet modules via $nrpe (or to be completely correct, $::nrpe).

I’ve updated my script that orders images shot from multiple cameras chronolgically based on EXIF data that was originally found here. The script now supports Canon CR2 and CRW raw files, Nikon NEF raw files, and jpegs. I’ve moved the script to my github account. You can find it here.

It’s no secret that I use WordPress for this blog. One of the reasons I like WordPress is the wide variety of plugins that are available. Since I blog a lot about perl/php/puppet code, I like to have a plugin that does syntax highlighting. For this task, I use the WP-Syntax plugin which is built on top of GeSHi. Unfortunately, it doesn’t have a language file for puppet. A quick search turned up this language file.

One thing I’ve struggled with in puppet in the past was managing iptables firewalls. I used to end up building a few different templates for the various firewalls that I had to manage and just passed in a list of ports to open up, but it was kind of a nightmare to manage as more and more applications with different requirements were added. The number of templates began to sprawl.

puppet and xinetd

I ran into an interesting problem with puppet today involving xinetd on CentOS 5. In one of my manifests, I had declared the following service resource: <service{"xinetd":ensure=>stopped,enable=>false,hasstatus=>true,} The problem I was seeing was every time the puppet client ran, it stopped the xinetd service: Sep 5 01:10:21 someserver puppet-agent[2300]: (/Stage[main]/Xinetd/Service[xinetd]/ensure) ensure changed 'running' to 'stopped' Sep 5 01:10:21 someserver puppet-agent[2300]: Finished catalog run in 5.82 seconds Sep 5 01:20:33 someserver puppet-agent[2300]: (/Stage[main]/Xinetd/Service[xinetd]/ensure) ensure changed 'running' to 'stopped' Sep 5 01:20:36 someserver puppet-agent[2300]: Finished catalog run in 11.

I added a couple of syntax check aliases (well, one’s actually a function because alias didn’t seem to like putting a pipe in there) to my .bashrc file: aliassynpp='puppet --parseonly --ignoreimport'synerb (){erb -x -T - "$@"|ruby -c } To check a .pp (manifest) file, I simply type synpp path/to/manifest.pp and to check a template synerb path/to/template.erb This assumes that you have a puppet client installed on your local machine.

UPDATE 10/24/2011: The script has been updated to support Canon CR2 and CRW raw files and JPEGS. I’ve also moved the script to my github account. Find it (and the latest installation instructions) here. Here’s the situation…..you’re shooting a wedding, bar mitzvah, or other event. You’re running and gunning, two cameras going full blast, switching back and forth. Your second shooter is laying down cover fire making sure you guys don’t miss any important moments.

I tried something different for dinner yesterday….made some pulled pork in the crock pot. That’s not the different part though….I used orange soda (yes, orange soda) as the braising liquid. I put a pork shoulder in the crock pot, covered with orange soda, and let it do its thing until I got home from work. Then I pulled the meat from the braising liquid, shredded it and mixed in some BBQ sauce.