Folks,
I'm on Windows and wrote a custom fact that was successfully tested in the default folder for facts (\facter\lib\facter).
Then when I decided to move it to my nodes, I put this fact inside a module folder (part of the project) /modules/module/facts.d/ as described in Puppet Docs.
When I run the agent on the nodes, the fact is correctly copied to the default folder for facts but while debugging, I noticed the following message:
> "Fact file C:/ProgramData/PuppetLabs/puppet/var/facts.d/flashplayeractivexversion.rb was parsed but returned an empty data set"
If I run facter on these nodes, I don't get my custom fact listed. Tested again putting this fact on the \facter\lib\facter on the nodes and again, it worked just fine.
Is there a different way where puppet execute facter accordingly with the facts location?
For those interested, below is the code for the fact I'm trying to deploy and attached the complete fact.
Cheers!
Facter.add("flashplayeractivexversion") do
confine :kernel => :windows
flashplayeractivexversion = "unknown"
begin
if RUBY_PLATFORM.downcase.include?("mswin") or RUBY_PLATFORM.downcase.include?("mingw32") require 'win32/registry'
Win32::Registry::HKEY_LOCAL_MACHINE.open('Software\Macromedia\FlashPlayerActiveX') do |reg|
reg.each do |name,type,data|
if name.eql?("Version")
flashplayeractivexversion = data
end
end
end
end
rescue
end
setcode do
flashplayeractivexversion
end
end
[custom_f_flashplayeractivex.JPG](/upfiles/1443395869177903.jpg)
↧