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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Cody Robertson
2011-Apr-10 18:56 UTC
[Puppet Users] Re: Mutliple custom facts not showing in facter
Can you invoke any custom facts at all? I suspect it facter might not be looking in the right directory for your puppet facts and thus it''s not finding them when run it locally. I''ve confirmed no issue with defining multiple facts in a single file / calling them with facter locally: root@falcon [~]# facter --puppet lvecpanel_version lve-cpanel-plugin-0.2-1.el5.cloudlinux root@falcon [~]# facter --puppet lvemanager_version cpanel-lvemanager-0.3-2.el5.cloudlinux -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Tony G.
2011-Apr-10 19:11 UTC
Re: [Puppet Users] Re: Mutliple custom facts not showing in facter
On Sun, Apr 10, 2011 at 1:56 PM, Cody Robertson <cody@hawkhost.com> wrote:> Can you invoke any custom facts at all? I suspect it facter might not be > looking in the right directory for your puppet facts and thus it''s not > finding them when run it locally. > > I''ve confirmed no issue with defining multiple facts in a single file / > calling them with facter locally: > > root@falcon [~]# facter --puppet lvecpanel_version > lve-cpanel-plugin-0.2-1.el5.cloudlinux > > root@falcon [~]# facter --puppet lvemanager_version > cpanel-lvemanager-0.3-2.el5.cloudlinux >This is interesting, what is the name of your fact? I replied on a forked thread, puppet-users was not included, here my response: [root@gnucloud facter]# echo $FACTERLIB [root@gnucloud facter]# export FACTERLIB=/opt/puppet/test/modules/foobar/lib/facter [root@gnucloud facter]# echo $FACTERLIB /opt/puppet/test/modules/foobar/lib/facter [root@gnucloud facter]# facter -p foo [root@gnucloud facter]# pwd /opt/puppet/test/modules/foobar/lib/facter [root@gnucloud facter]# ls foobar.rb [root@gnucloud facter]# cat 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 My *guess* is that facter does not like having two facts in one fact, here I simply created another fact: [root@gnucloud facter]# cat onefact.rb require ''facter'' Facter.add("onefact") do setcode do %x{/bin/date +%s}.chomp end end [root@gnucloud facter]# facter -p onefact 1302309123 Working without issues.. Doing another test, this time I just renamed the file with the fact: [root@gnucloud facter]# mv onefact.rb onefact2.rb [root@gnucloud facter]# facter -p onefact [root@gnucloud facter]# facter -p onefact2 [root@gnucloud facter]# aha!, seems like facter is looking for the fact name that matches the file, woot! is this ok? is this the expected behavior? Then somehow my assumption was correct, facter is not able to pick facts that the name of the file differs from the fact defined, anyway puppet processes them correctly. --> 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+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Cody Robertson
2011-Apr-10 21:09 UTC
Re: [Puppet Users] Re: Mutliple custom facts not showing in facter
Strange - in the example I used the file is named lvemanager_versions.rb while the facts are lvemanager_version and lvecpanel_version. Although it''s highly unlikely this is the problem I''m running facter 1.5.8 which is one version you''re not running.. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Tony G.
2011-Apr-10 21:18 UTC
Re: [Puppet Users] Re: Mutliple custom facts not showing in facter
Facter 1.5.9 Thanks sent from my android On Apr 10, 2011 4:09 PM, "Cody Robertson" <cody@hawkhost.com> wrote: Strange - in the example I used the file is named lvemanager_versions.rb while the facts are lvemanager_version and lvecpanel_version. Although it''s highly unlikely this is the problem I''m running facter 1.5.8 which is one version you''re not running.. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group... -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Cody Robertson
2011-Apr-11 01:37 UTC
Re: [Puppet Users] Re: Mutliple custom facts not showing in facter
It looks like it''s a bug in 1.5.9. I upgraded this particular node to the latest (rc4) and now the multiple facts don''t work as you initially described. I''d recommend opening a bug report as something changed across versions to cause this. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Cody Robertson
2011-Apr-11 01:42 UTC
Re: [Puppet Users] Re: Mutliple custom facts not showing in facter
Er, I upgraded to Facter rc5* -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Tony G.
2011-Apr-11 03:04 UTC
Re: [Puppet Users] Re: Mutliple custom facts not showing in facter
I tried with rc4, upgradec to rc5 and same behavior, which version you tested out before, I recall testing on 1.5.7 too, with the same thing. Thanks. On Sun, Apr 10, 2011 at 8:42 PM, Cody Robertson <cody@hawkhost.com> wrote:> Er, I upgraded to Facter rc5* > > -- > 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+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Cody Robertson
2011-Apr-11 03:21 UTC
Re: [Puppet Users] Re: Mutliple custom facts not showing in facter
I''ve only tested this on 1.5.8 where it worked. Upgraded to 1.5.9rc5 and it appears broken. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
James Turnbull
2011-Apr-11 06:06 UTC
Re: [Puppet Users] Re: Mutliple custom facts not showing in facter
Cody Robertson wrote:> I''ve only tested this on 1.5.8 where it worked. Upgraded to 1.5.9rc5 and it appears broken. >Can one of you please log a ticket for this - we''d obviously like to fix it before we release Facter 1.5.9. Thanks James -- James Turnbull Puppet Labs 1-503-734-8571 -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Cody Robertson
2011-Apr-11 06:45 UTC
Re: [Puppet Users] Re: Mutliple custom facts not showing in facter
I''ll test it on more versions tomorrow to see if I can pinpoint exactly where the change happened: http://projects.puppetlabs.com/issues/7039 -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Ohad Levy
2011-Apr-11 09:03 UTC
Re: [Puppet Users] Re: Mutliple custom facts not showing in facter
git bisect is a great way to figure out which commit broke it. Ohad On Mon, Apr 11, 2011 at 9:45 AM, Cody Robertson <cody@hawkhost.com> wrote:> I''ll test it on more versions tomorrow to see if I can pinpoint exactly > where the change happened: http://projects.puppetlabs.com/issues/7039 > > -- > 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+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Cody Robertson
2011-Apr-11 17:41 UTC
Re: [Puppet Users] Re: Mutliple custom facts not showing in facter
On 04/11/2011 05:03 AM, Ohad Levy wrote:> git bisect is a great way to figure out which commit broke it. > > Ohad > > On Mon, Apr 11, 2011 at 9:45 AM, Cody Robertson <cody@hawkhost.com > <mailto:cody@hawkhost.com>> wrote: > > I''ll test it on more versions tomorrow to see if I can pinpoint > exactly where the change happened: > http://projects.puppetlabs.com/issues/7039 > > -- > 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 > <mailto:puppet-users@googlegroups.com>. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com > <mailto:puppet-users%2Bunsubscribe@googlegroups.com>. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > > > -- > 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+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en.I went ahead and gave it a whirl and it appears to have done the job in finding which commit introduced the change. Thanks for the tip! -- Cody Robertson 1-800-859-8803 ext. 5 -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.