Decommission merulo
[mirror/dsa-puppet.git] / modules / debian-org / lib / facter / raidarray.rb
1 Facter.add("smartarraycontroller") do
2         confine :kernel => :linux
3         setcode do
4                 if FileTest.exist?("/dev/cciss/")
5                         true
6                 elsif FileTest.exist?("/sys/module/hpsa/")
7                         true
8                 else
9                         ''
10                 end
11         end
12 end
13
14 Facter.add("ThreeWarecontroller") do
15         confine :kernel => :linux
16         setcode do
17                 is3w = ''
18                 if FileTest.exist?("/proc/scsi/scsi")
19                         IO.foreach("/proc/scsi/scsi") { |x|
20                                 is3w = true if x =~ /Vendor: 3ware/
21                         }
22                 end
23                 is3w
24         end
25 end
26
27 Facter.add("megaraid") do
28         confine :kernel => :linux
29         setcode do
30                 if FileTest.exist?("/dev/megadev0")
31                         true
32                 else
33                         ''
34                 end
35         end
36 end
37
38 Facter.add("mptraid") do
39         confine :kernel => :linux
40         setcode do
41                 if FileTest.exist?("/dev/mptctl") or FileTest.exist?("/dev/mpt0") or FileTest.exist?("/proc/mpt/summary")
42                         true
43                 else
44                         ''
45                 end
46         end
47 end
48
49 Facter.add("aacraid") do
50         confine :kernel => :linux
51         setcode do
52                 if FileTest.exist?("/dev/aac0")
53                         true
54                 else
55                         ''
56                 end
57         end
58 end
59
60 Facter.add("swraid") do
61         confine :kernel => :linux
62         setcode do
63                 swraid = ''
64                 if FileTest.exist?("/proc/mdstat") && FileTest.exist?("/sbin/mdadm")
65                         IO.foreach("/proc/mdstat") { |x|
66                                 swraid = true if x =~ /md[0-9]+ : active/
67                         }
68                 end
69                 swraid
70         end
71 end
72