Add morricone
[mirror/dsa-puppet.git] / facts / raidarray.rb
1 Facter.add("smartarraycontroller") do
2         confine :kernel => :linux
3         ENV["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin"
4         setcode do
5                 ishp = "false"
6                 lspciexists = system "/bin/bash -c 'which lspci >&/dev//null'"
7                 if $?.exitstatus == 0
8                         %x{lspci 2>&1}.each { |s|
9                                 ishp = "true" if s =~ /RAID bus controller: (.*) Smart Array/
10                         }
11                 end
12                 ishp == "true"
13         end
14 end
15
16 Facter.add("mptcontroller") do
17         confine :kernel => :linux
18         setcode do
19                 FileTest.exist?("/proc/mpt/summary")
20         end
21 end
22
23 Facter.add("3warecontroller") do
24         confine :kernel => :linux
25         setcode do
26                 is3w = "false"
27                 if FileTest.exist?("/proc/scsi/scsi")
28                         IO.foreach("/proc/scsi/scsi") { |x|
29                                 is3w = "true" if x =~ /Vendor: 3ware/
30                         }
31                 end
32                 is3w == "true"
33         end
34 end
35
36 Facter.add("swraid") do
37         confine :kernel => :linux
38         setcode do
39                 swraid = "false"
40                 if FileTest.exist?("/proc/mdstat") && FileTest.exist?("/sbin/mdadm")
41                         IO.foreach("/proc/mdstat") { |x|
42                                 swraid = "true" if x =~ /md[0-9]+ : active/
43                         }
44                 end
45                 swraid == "true"
46         end
47 end
48