My custom fact is not being used during a puppet run, but I can see it
when I run puppet manually. This is quite similar to
http://projects.reductivelabs.com/issues/1918 except my fact works on
the command line but not from within puppet.

This is the first time I have tried adding a fact so it is possible I
have made a mistake somewhere. I have read everything I can find on
adding facts and I am pretty sure it is set up correctly.

Lots of info follows.... if anyone could give me some tips on what
could be going wrong I would appreciate it.

Thanks,

Mike

http://pastie.org/892038

[r...@test01 puppet]# puppetd --version
0.25.4
[r...@test01 puppet]# facter --version
1.5.7
[r...@test01 puppet]# puppet --configprint libdir
/var/lib/puppet/lib
[r...@test01 puppet]# ls -al $(puppet --configprint libdir)/facter
total 12
drwxr-xr-x 2 root root 4096 Mar 25 18:28 .
drwxr-xr-x 3 root root 4096 Mar 25 07:23 ..
-rw-r--r-- 1 root root   86 Mar 25 18:28 testfact.rb
[r...@test01 puppet]# cat $(puppet --configprint libdir)/facter/
testfact.rb
require 'facter'

Facter.add("testfact") do
    setcode do
        "yep"
    end
end
[r...@test01 puppet]# facter | grep testfact
[r...@test01 puppet]# facter --puppet | grep testfact
testfact => yep
[r...@test01 puppet]# echo $RUBYLIB
/var/lib/puppet/lib
[r...@test01 puppet]# echo $FACTERLIB
/var/lib/puppet/lib/facter


So it seems as if every works correctly, but when I try and access
this fact in a node definition nothing happens:
[r...@test01 puppet]# cat manifests/nodes/test.pp
node 'test01.example.com' {
        notice("testfact: $testfact")
}
[r...@test01 puppet]# puppetd --no-daemonize --debug --verbose -t



In another terminal:
[r...@test01 ~]#  puppetmasterd -d --no-daemonize -v --trace
<snip>
notice: Scope(Node[test01.example.com]): testfact:
notice: Compiled catalog for test01.example.com in 0.01 seconds
<snip>


stracing the puppet daemon shows that the testfact.rb file is being
opened after a number of failed attempts to find it:
[r...@test01 puppet]# strace -o trace -ff puppetd --no-daemonize --
debug --verbose -t
[r...@test01 puppet]# grep testfact * | grep ENOENT | wc -l #show
failed attempts at opening
40
[r...@test01 puppet]# grep testfact * | grep RDONLY | wc -l #show
successful attempts at writing
13

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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