Skip to content

Commit 01ae9e5

Browse files
author
Gerard Hickey
committed
Updated to check for fact before trying to publish it
1 parent c0ef09e commit 01ae9e5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

hanlon_microkernel/facter/hnl_mk_mem.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,19 @@ def def_to_hash(definition, delimiter=':')
115115
begin
116116
# Create the facts for the firmware info
117117
%w{description vendor physical_id version date size capabilities capacity}.each do |fact|
118-
Facter.add("mk_hw_fw_#{fact}") do
119-
setcode { memory['firmware'][fact] }
118+
if memory['firmware'].has_key? fact
119+
Facter.add("mk_hw_fw_#{fact}") do
120+
setcode { memory['firmware'][fact] }
121+
end
120122
end
121123
end
122124

123125
# Create the facts for the memory info
124126
%w{description physical_id slot size }.each do |fact|
125-
Facter.add("mk_hw_mem_#{fact}") do
126-
setcode { memory['memory'][fact] }
127+
if memory['memory'].has_key? fact
128+
Facter.add("mk_hw_mem_#{fact}") do
129+
setcode { memory['memory'][fact] }
130+
end
127131
end
128132
end
129133

0 commit comments

Comments
 (0)