Skip to content

Commit b5f8a55

Browse files
author
Gerard Hickey
committed
Fixed cpu facter module when cpu entries are disabled
1 parent 078fee9 commit b5f8a55

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

hanlon_microkernel/facter/hnl_mk_cpu.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@
2323
lines = definition.split(/\n/)
2424
# section title is on the first line
2525
cpu = lines.shift.tr(':', '')
26-
cpus += 1
27-
# Create a hash of attributes for each section (i.e. cpu)
28-
attribs = Hash[ lines.collect { |l| l =~ /^\s*([^:]+):\s+(.*)\s*$/; v=$2; [$1.gsub(/\s/, '_'), v] } ]
29-
attribs.each_pair do |attrib, val|
30-
Facter.add("mk_hw_#{cpu}_#{attrib}") do
31-
setcode { val }
26+
unless cpu =~ /disabled/i
27+
cpus += 1
28+
# Create a hash of attributes for each section (i.e. cpu)
29+
attribs = Hash[ lines.collect { |l| l =~ /^\s*([^:]+):\s+(.*)\s*$/; v=$2; [$1.gsub(/\s/, '_'), v] } ]
30+
attribs.each_pair do |attrib, val|
31+
Facter.add("mk_hw_#{cpu}_#{attrib}") do
32+
setcode { val }
33+
end
3234
end
3335
end
3436
end

0 commit comments

Comments
 (0)