Playing with Facter
I’m on-call tonight so I invested some time in facter, “A cross-platform Ruby library for retrieving facts from operating systems.” While facter is an interesting command line program (its extension mechanism is quite nice) its main claim to fame is that it’s used by puppet (which I’m slowly evaluating as a CFEngine replacement) to determine facts about a machine.
While the docs are a little light on the ground the tgz contains a couple
of examples and after some playing around I think I’ve got a basic Linux
Bonding fact ready. For your viewing pleasure, the
Facter Linux Network
Bonding custom fact. It’s not amazingly powerful or complex but it does
seem to do what I want and it gave me a reason to look around the Ruby
Dir class so it’s not all bad. I’ve mostly put it up to show
how easy it is for someone with very little ruby knowledge to extend
Note: I also discovered that you can’t do a
confine :bonding =>
:true, facter works on literal string values, not on true or false.