puppetlabs/facter — pull request #426 by apenney (2013-04-12 20:20:05+00:00)
Title: Refactor how we get the path for ifconfig

This is an attempt at a minimal PR to prove out a concept finch and I talked about for slowly refactoring the util/ip.rb stuff. There's been about 8 attempts at this so far and during the conversations we had finch made me realize that we don't need hash maps and lookup systems in these files because Facter -itself- is a lookup tool.

All this does is extract the path handling out to a fact and trim ip.rb to use it. I had to make some minimal changes to the unit tests to get this working, and in the past this has been a blocker - however the tests are so implementation tied that it's literally impossible to refactor this in any meaningful way without touching them.

I stopped the work here, short of starting the /sbin/ip support, to see if this is an acceptable path to take. I plan to make a bunch of other facts too, ones to return arguments, regexps, and so forth, and remove all the hashmaps, as this work continues.