Merge pull request #204 from jeffweiss/ticket/master/11466_remove_duplicate_memorytotal_fact
(#11466) Remove deprecated memorytotal fact
Daniel Pittman
12 years ago
260 | 260 |
memtotal = Facter::Util::Resolution.exec("sysctl -n hw.physmem")
|
261 | 261 |
Facter::Memory.scale_number(memtotal.to_f,"")
|
262 | 262 |
end
|
263 | |
end
|
264 | |
|
265 | |
# http://projects.puppetlabs.com/issues/11436
|
266 | |
#
|
267 | |
# Unifying naming for the amount of physical memory in a given host.
|
268 | |
# This fact is DEPRECATED and will be removed in Facter 2.0 per
|
269 | |
# http://projects.puppetlabs.com/issues/11466
|
270 | |
Facter.add("MemoryTotal") do
|
271 | |
setcode do
|
272 | |
Facter.value("memorysize")
|
273 | |
end
|
274 | |
end
|
|
263 |
end⏎
|
141 | 141 |
computer.stubs(:TotalPhysicalMemory).returns("4193837056")
|
142 | 142 |
Facter::Util::WMI.stubs(:execquery).returns([computer])
|
143 | 143 |
|
144 | |
Facter.fact(:MemoryTotal).value.should == '3.91 GB'
|
|
144 |
Facter.fact(:MemorySize).value.should == '3.91 GB'
|
145 | 145 |
end
|
146 | 146 |
end
|
147 | |
|
148 | |
it "should use the memorysize fact for the memorytotal fact" do
|
149 | |
Facter.fact("memorysize").expects(:value).once.returns "yay"
|
150 | |
Facter::Util::Resolution.expects(:exec).never
|
151 | |
Facter::Memory.expects(:meminfo_number).never
|
152 | |
Facter.fact("memorytotal").value.should == "yay"
|
153 | |
end
|
154 | 147 |
end
|