Add software raid test
[mirror/dsa-puppet.git] / facts / raidcontroller.rb
index d4bdd07..263b16b 100644 (file)
@@ -1,4 +1,4 @@
-Facter.add("raidcontroller") do
+Facter.add("smartarraycontroller") do
        confine :kernel => :linux
        ENV["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin"
        setcode do
@@ -32,3 +32,17 @@ Facter.add("3warecontroller") do
                is3w
        end
 end
+
+Facter.add("swraid") do
+       confine :kernel => :linux
+       setcode do
+                swraid = "false"
+               if FileTest.exist?("/proc/mdstat") && FileTest.exist?("/sbin/mdadm")
+                        IO.foreach("/proc/mdstat") { |x|
+                                swraid = "true" if x =~ /md[0-9]+ : active/
+                        }
+                end
+                swraid
+       end
+end
+