munin must run ip6 plugin as root as well
[mirror/dsa-puppet.git] / facts / ipaddresses.rb
index f1bbd69..17dbd84 100644 (file)
@@ -1,4 +1,5 @@
 Facter.add("v4ips") do
+        confine :kernel => :linux
         addrs = []
         %x{ip addr list}.each do |line|
                 next unless line =~ /\s+inet/
@@ -13,6 +14,7 @@ Facter.add("v4ips") do
 end
 
 Facter.add("v6ips") do
+        confine :kernel => :linux
         addrs = []
         %x{ip addr list}.each do |line|
                 next unless line =~ /\s+inet/
@@ -21,8 +23,12 @@ Facter.add("v6ips") do
                         addrs << $1
                 end
         end
+        ret = addrs.join(",")
+        if ret.empty?
+          ret = 'no'
+        end
         setcode do
-                addrs.join(",")
+          ret
         end
 end