File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
hanlon_microkernel/facter Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 17
17
lshw_c_volume_str = %x[sudo #{ lshw_cmd } -c volume 2> /dev/null]
18
18
19
19
# process the results from lshw -c volume
20
+ vols = 0
20
21
lshw_c_volume_str . split ( /\s \s \* -/ ) . each do |definition |
21
22
unless definition . empty?
22
23
lines = definition . split ( /\n / )
23
24
# section title is on the first line
24
- volume = lines . shift . tr ( ':' , '' )
25
+ volume = lines . shift . tr ( ':' , '' ) and vols += 1
26
+
25
27
# Create a hash of attributes for each section (i.e. cpu)
26
28
attribs = Hash [ lines . collect { |l | l =~ /^\s *([^:]+):\s +(.*)\s *$/ ; v = $2; [ $1. gsub ( /\s / , '_' ) , v ] } ]
27
29
attribs . each_pair do |attrib , val |
31
33
end
32
34
end
33
35
end
36
+
37
+ # Report on the number volumes found
38
+ Facter . add ( "mk_hw_volume_count" ) do
39
+ setcode { vols }
40
+ end
You can’t perform that action at this time.
0 commit comments