X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=facts%2Fraidcontroller.rb;h=12d140fd078ae57347a77146c0befcf0fc0fa9ff;hb=6c0e762ea3621bcb1b3ac4173b06b3e0bb5b6a11;hp=d4bdd07ae9e91aac88f9bc44cee2fa03bb5b4e53;hpb=c496cfa66b6d9b220a8ecaf08bdc1c4a9e8d8799;p=mirror%2Fdsa-puppet.git diff --git a/facts/raidcontroller.rb b/facts/raidcontroller.rb index d4bdd07ae..12d140fd0 100644 --- a/facts/raidcontroller.rb +++ b/facts/raidcontroller.rb @@ -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 @@ -9,7 +9,7 @@ Facter.add("raidcontroller") do ishp = "true" if s =~ /RAID bus controller: (.*) Smart Array/ } end - ishp + ishp == "true" end end @@ -29,6 +29,20 @@ Facter.add("3warecontroller") do is3w = "true" if x =~ /Vendor: 3ware/ } end - is3w + is3w == "true" 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 == "true" + end +end +