File: //var/cache/puppet/lib/facter/agent.rb
# [.m] Fact: Puppet agent settings
require 'puppet'
Facter.add(:agent_settings) do
settings = Puppet.settings.to_h
# Resolve setting values to their bare value instead of the puppet setting class
pretty_settings = {}
settings.each do |key, value|
unless value.value.eql?(Float::INFINITY)
pretty_settings[key] = value.value
end
end
# pretty_settings is a huge wall of keys. Do we really need all settings as fact?
setcode do
{
'confdir' => Puppet.settings[:confdir],
'config' => Puppet.settings[:config],
'ssldir' => Puppet.settings[:ssldir],
'hostcert' => Puppet.settings[:hostcert],
'hostprivkey' => Puppet.settings[:hostprivkey],
'hostcrl' => Puppet.settings[:hostcrl],
'localcacert' => Puppet.settings[:localcacert],
'tags' => Puppet.settings[:tags].gsub('::', '-').split(','),
'settings_hash' => pretty_settings,
}
end
end
# vim: et ts=8 sts=2 sw=2 fdm=marker