Small Mosaic


Categories:

books
career
codinghorrors
comics
events
geekstuff
justdont
languages
languages/bash
linkshot
magazines
meta
misctech
movies
nottech
operatingsystems
operatingsystems/linux
operatingsystems/linux/debian
operatingsystems/solaris
paranoidadmin
perl
python
ruby
security
security/apache
security/tools
serversmells
sites
specifications
sysadmin
tools
tools/commandline
tools/firefox
tools/gui
tools/network
tools/online
tools/online/greasemonkey
unixdaemon

Archives:

October 20085
September 20084
August 200812
July 20089
April 20084
March 20081
February 20081
January 200815
August 20072
June 20079
May 20076
April 20078
March 200731
February 20073
January 200721
December 20061
November 20064
October 20066
September 200632
August 200617
July 200614
June 20069
May 200613
March 200611
February 200616
January 200611
December 20051
November 20056
October 200519
September 200525
August 200516
July 200516
June 200513
May 20052
April 200519
March 200531
February 200520
January 200531
December 200421
November 200430
October 200432
September 200418
August 20047
July 200414
June 20045

Tue, 14 Aug 2007

Adding a fact to Pfacter
While dabbling with Puppet I've spent a fair amount of time investigating facter, one of the tools (although puppet uses it as a library) it's built on. While I quite like the format it uses to define a fact I'm hampered by my lack of ruby experience; simple things take me longer than they should. So when I noticed Pfacter while looking for a module on CPAN recently I thought I'd have a look at how it could be done in perl.

Firstly I have to mention the install, or rather lack of one. The module doesn't install via CPAN on Linux (and after looking at its CPAN Testers page it seems I'm not the only one with the problem) which makes it a bit of a pain. Once I'd hand wrangled an install I decided to see what it picked up about the system and how to add my own fact.

I can't complain about the number of built in facts, it's pretty comparable to the original facter (which I've added my own custom facts to now.) Adding a fact was a little more complex. Once I'd written one (I cribbed from the existing facts - but with strict and warnings added) I dropped it in to the correct directory (which I found with find / -name cfclasses.pm) and ran pfacter; and nothing happened.

After re-checking the code of the ipv6.pm fact I found the first major difference between the perl and ruby versions. Ruby facter loads all the facts in a directory and attempts them all, pfacter requires you to manually add them to the @modules array before it'll run them. Once I'd done that and reran pfacter it showed that my machine is ipv6 enabled.

So the verdict? It could be useful to pull out certain information about the system, I found the perl version easier to extend as it doesn't add its own little language to the mix, but for most people the biggest selling point of facter is its use within puppet - which this version lacks. Still, it was interesting to see another (very) different approach to collecting system information.

Like this post? - Digg Me! | Add to del.icio.us! | reddit this!

Posted: 2007/08/14 20:46 | /perl | Permanent link to this entry | This entry + same date


books career codinghorrors events geekstuff justdont languages/bash linkshot magazines meta misctech movies nottech operatingsystems/linux operatingsystems/linux/debian operatingsystems/solaris perl python ruby security security/apache security/tools serversmells sites specifications sysadmin tools/commandline tools/firefox tools/gui tools/network tools/online tools/online/greasemonkey unixdaemon

Copyright © 2000-2005 Dean Wilson XML feed logo