I had just the fact example you used in (/etc/puppet/modules/modulewithfact/lib/facter/test_fact.rb)...
Facter.add(:test_fact) do
confine :kernel => "Linux"
setcode do
"Content from the fact"
end
end
The puppet run was as follows...
puppet agent -t
info: Loading facts in /etc/puppet/modules/modulewithfact/lib/facter/test_fact.rb
info: Caching catalog for precise-64.localdomain
info: Applying configuration version '1353888521'
notice: /Stage[main]//Node[default]/File[/tmp/puppettest]/ensure: created
notice: Finished catalog run in 0.02 seconds
I wasn't able to reproduce this on precise. I used the following manifest to test the fact:
node default {
file { '/tmp/puppettest':
ensure => present,
content => $test_fact,
}
}
I had just the fact example you used in (/etc/puppet/ modules/ modulewithfact/ lib/facter/ test_fact. rb)...
Facter. add(:test_ fact) do
confine :kernel => "Linux"
setcode do
"Content from the fact"
end
end
The puppet run was as follows...
puppet agent -t modules/ modulewithfact/ lib/facter/ test_fact. rb 64.localdomain main]// Node[default] /File[/ tmp/puppettest] /ensure: created
info: Loading facts in /etc/puppet/
info: Caching catalog for precise-
info: Applying configuration version '1353888521'
notice: /Stage[
notice: Finished catalog run in 0.02 seconds
And the content was as expected.
cat /tmp/puppettest
Content from the fact