Hi,

I've noticed that defining multiple facts in one file is possible, and
puppet can make use of them correctly, but when trying to call with facter
--puppet they are not shown, do I need something special to make them work
as any other single custom fact?

Master is running 2.6.7

This is a custom fact with two facts in it:
[modules/foobar/lib/facter/foobar.rb ]
require 'facter'
Facter.add("foo") do
  setcode do
    %x{/bin/date +%s}.chomp
  end
end
Facter.add("bar") do
  setcode do
    %x{/bin/date +%s}.chomp
  end
end

I used a simple notify in the node like this:  notify{ "custom_fact":
message => "foo:$foo bar:$bar"}

Tested with Puppet Agent 2.6.2 and 2.6.7

Pulling the fact and makes use of it:

# puppet agent -t --environment=test --pluginsync
info: Retrieving plugin
notice: /File[/var/lib/puppet/lib/facter/foobar.rb]/ensure: defined content
as '{md5}c28d8a783d44b9c15b7e61a6d90cf0e3'
notice: /File[/var/lib/puppet/lib/facter/utime.rb]/ensure: removed
info: Loading downloaded plugin /var/lib/puppet/lib/facter/foobar.rb
info: Loading facts in foobar
info: Loading facts in foobar
info: Caching catalog for squeeze.tonyskapunk.net
info: Applying configuration version '1302146930'
notice: foo:1302147318 bar:1302147318
notice: /Stage[main]//Node[squeeze.tonyskapunk.net]/Notify[custom_fact]/message:
defined 'message' as 'foo:1302147318 bar:1302147318'
notice: Finished catalog run in 0.07 seconds

But not able to call them with facter:

root@squeeze:~# facter --puppet foo
root@squeeze:~# facter --puppet bar
root@squeeze:~#

Tested with Facter 1.5.7 and 1.5.9

Thanks.

-- 
Tony
http://blog.tonyskapunk.net

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to