File facter-ip-interface.patch of Package facter.158

Index: facter-2.0.2/lib/facter/util/ip.rb
===================================================================
--- facter-2.0.2.orig/lib/facter/util/ip.rb
+++ facter-2.0.2/lib/facter/util/ip.rb
@@ -73,7 +73,10 @@ module Facter::Util::IP
 
   def self.get_all_interface_output
     case Facter.value(:kernel)
-    when 'Linux', 'OpenBSD', 'NetBSD', 'FreeBSD', 'Darwin', 'GNU/kFreeBSD', 'DragonFly'
+    when 'Linux'
+      output = Facter::Util::IP.exec_ip(["link"])
+      output.gsub!(/^\d+:\s*/, "")				# delete leading number
+    when 'OpenBSD', 'NetBSD', 'FreeBSD', 'Darwin', 'GNU/kFreeBSD', 'DragonFly'
       output = Facter::Util::IP.exec_ifconfig(["-a","2>/dev/null"])
     when 'SunOS'
       output = Facter::Util::IP.exec_ifconfig(["-a"])
@@ -92,6 +95,13 @@ module Facter::Util::IP
 
 
   ##
+  # exec_ip uses the Linux ip command
+  #
+  # @return [String] the output of `ip #{arguments} 2>/dev/null` or nil
+  def self.exec_ip(additional_arguments=[])
+    Facter::Core::Execution.exec("/bin/ip #{additional_arguments.join(' ')}")
+  end
+  ##
   # exec_ifconfig uses the ifconfig command
   #
   # @return [String] the output of `ifconfig #{arguments} 2>/dev/null` or nil
openSUSE Build Service is sponsored by