require 'facter'

raw = Facter::Core::Execution.execute('puppet config print')
config = {}
raw.each_line do |entry|
  entry_array = entry.split(' = ')
  config[entry_array[0]] = entry_array[1].chomp
end

config.each do |key, value|
  # Add a prefix to avoid name colisions
  Facter.add("agentfacts_#{key}") do
    setcode do
      value
    end
  end
end

require 'facter'

notify(Facter::Core::Execution.execute('pwd'))

raw = Facter::Core::Execution.execute('puppet config print')
config = {}
raw.each_line do |entry|
  entry_array = entry.split(' = ')
  config[entry_array[0]] = entry_array[1].chomp
end

config.each do |key, value|
  # Add a prefix to avoid name colisions
  Facter.add("agentfacts_#{key}") do
    setcode do
      value
    end
  end
end

Add a debug print to figure out the working directory of the factor run.
Add a debug print to figure out the working directory of the factor run.
