Please review pull request #181: Adds fact about machine's RAID Controller opened by (LarsFronius)
Description:
This adds a small fact to read out machine's raid controllers.
We use it to check RAID Controller on host and install the matching utils.
We also feed our nagios raid check with information from it.
- Opened: Tue Feb 28 22:09:06 UTC 2012
- Based on: puppetlabs:master (a4f433e59653d0e0827744c7219d1c40aaabf0a2)
- Requested merge: LarsFronius:raid (b267396782fc26096598185655d8f290a8387de1)
Diff follows:
diff --git a/lib/facter/raid.rb b/lib/facter/raid.rb new file mode 100644 index 0000000..127dc57 --- /dev/null +++ b/lib/facter/raid.rb @@ -0,0 +1,32 @@ +# raid.rb +# Additional Facts about the machine's RAID-Controller +# +# Author: Lars Fronius ([email protected]) +# + +if Facter.value(:kernel) == "Linux" + raidcontroller_num = -1 + raidcontroller_list = [] + Facter::Util::Resolution.exec('lspci').each do |l| + if l =~ /^\d{2}:\d{2}.\d{1} RAID bus controller: (.*)$/ + raidcontroller_num += 1 + raidcontroller_list[raidcontroller_num] = $1 unless raidcontroller_num == -1 + end + end + + Facter.add("RAIDControllerCount") do + confine :kernel => :linux + setcode do + raidcontroller_list.length.to_s + end + end + + raidcontroller_list.each_with_index do |desc, i| + Facter.add("RAIDController#{i}") do + confine :kernel => :linux + setcode do + desc + end + end + end +end
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
