diff options
author | Luke Kanies <luke@madstop.com> | 2009-04-20 11:40:42 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2009-04-20 16:48:34 -0500 |
commit | d89ea7a88a93b6ce3132d9dd394b4187eb460cb2 (patch) | |
tree | ba349951d915fd192e511c153af6824447a10187 /lib | |
parent | 7fa257689b08d5c6c8e22da9da49f0679aa9b1d9 (diff) | |
download | facter-d89ea7a88a93b6ce3132d9dd394b4187eb460cb2.tar.gz facter-d89ea7a88a93b6ce3132d9dd394b4187eb460cb2.tar.xz facter-d89ea7a88a93b6ce3132d9dd394b4187eb460cb2.zip |
Fixing ifconfig warnings generated on OS X
The interface collection regex was leaving trailing
':' characters on the interface names, which meant
individual interfaces weren't quite right.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/facter/util/ip.rb | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/facter/util/ip.rb b/lib/facter/util/ip.rb index e06e506..374d9f3 100644 --- a/lib/facter/util/ip.rb +++ b/lib/facter/util/ip.rb @@ -45,17 +45,13 @@ module Facter::Util::IP end def self.get_interfaces - int = nil + return [] unless output = Facter::Util::IP.get_all_interface_output() - output = Facter::Util::IP.get_all_interface_output() - - # We get lots of warnings on platforms that don't get an output - # made. - if output - int = output.scan(/^\w+[.:]?\d+[.:]?\d*[.:]?\w*/) - else - [] - end + # Our regex appears to be stupid, in that it leaves colons sitting + # at the end of interfaces. So, we have to trim those trailing + # characters. I tried making the regex better but supporting all + # platforms with a single regex is probably a bit too much. + output.scan(/^\w+[.:]?\d+[.:]?\d*[.:]?\w*/).collect { |i| i.sub(/:$/, '') } end def self.get_all_interface_output |