Ask Your Question

Windows - Fact file was parsed but returned an empty data set

asked 2015-09-27 18:22:02 -0500

Sarsa-JP gravatar image

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"

    if RUBY_PLATFORM.downcase.include?("mswin") or RUBY_PLATFORM.downcase.include?("mingw32") require 'win32/registry''Software\Macromedia\FlashPlayerActiveX') do |reg|
    reg.each do |name,type,data|
      if name.eql?("Version")
        flashplayeractivexversion = data


 setcode do


edit retag flag offensive close merge delete


I tried running this ruby script on windows, but it errored out . I am not very confident in ruby, however, you can use the following powershell code: $version = (Get-Item HKLM:\Software\Macromedia\FlashPlayerActiveX).GetValue("Version") Write-Host "flashplayeractivexversion="$version

pratyush04 gravatar imagepratyush04 ( 2015-10-05 20:57:14 -0500 )edit

Thanks for the PS Praty, To use the ruby code above, save it to a .rb file, and for testing, place it into a module as Josh said below.

Sarsa-JP gravatar imageSarsa-JP ( 2015-10-30 07:22:16 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2015-10-14 02:30:16 -0500

joshc gravatar image

Custom facts using the Facter DSL method Facter.add(:name) should be placed in the module's lib/facter directory, e.g. lib/facter/flashplayeractivexversion.rb. When the agent runs, it will pluginsync the fact into C:/ProgramData/PuppetLabs/puppet/var/lib/facter/flashplayeractivexversion.rb

The facts.d directory is for external facts, which can be text or executable-based, and on windows that includes .bat, .cmd, .ps1. Facter will either parse or execute the external fact based on its extension. External facts are more intended for cases where you don't want to use the Facter DSL to define facts, e.g. you already have asset information in a ini-file that you want to collect or use another language to generate fact values, e.g. powershell.

edit flag offensive delete link more


Also watch out for registry redirection. You can pass an argument to `Win32::Registry::<key>.open` to disable redirection.

joshc gravatar imagejoshc ( 2015-10-14 02:31:32 -0500 )edit

When I copy the Ruby custom facter code to C:\Ruby193\lib\ruby\gems\1.9.1\gems\facter-2.4.6-x86-mingw32\lib\facter , it works fine. But not from C:\ProgramData\PuppetLabs\puppet\var\lib\facter. Is the locations got changed ?

ajithu gravatar imageajithu ( 2017-03-24 02:14:22 -0500 )edit

answered 2015-10-30 07:11:39 -0500

Sarsa-JP gravatar image

updated 2016-01-03 01:22:17 -0500

Hey Josh, First, sorry for the late reply, I was out of the country. I followed your instructions and now I have the facts working great! Thanks!

Thanks a lot!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-09-27 18:22:02 -0500

Seen: 1,122 times

Last updated: Jan 03 '16