On May 26, 2011, at 2:50 PM, M C wrote:

> Hi, I have a big problem with custom facts. I created a stub module with a 
> "lib/facter" directory as stated in the official Puppet documentation.
> This is the output i get:
> 
> # puppetd -t --pluginsync
> info: Retrieving plugin
> notice: /File[/var/lib/puppet/lib]/mode: mode changed '755' to '775'
> notice: /File[/var/lib/puppet/lib/facter]/ensure: created
> notice: /File[/var/lib/puppet/lib/facter/certname.rb]/ensure: defined content 
> as '{md5}dd2f6e661ef1d2d29fa068e8a7d4aa19'
> notice: /File[/var/lib/puppet/lib/facter/rootdevice.rb]/ensure: defined 
> content as '{md5}a19202a1c8e9f3da0f983403e463fd01'
> info: Loading downloaded plugin /var/lib/puppet/lib/facter/rootdevice.rb
> info: Loading downloaded plugin /var/lib/puppet/lib/facter/certname.rb
> info: Loading facts in certname
> info: Loading facts in rootdevice
> info: Loading facts in certname
> info: Loading facts in rootdevice
> info: Caching catalog for puppet-1306413279
> info: Applying configuration version '1306413876'
> notice: /Stage[main]/Test/File[/tmp/puppet.test]/ensure: created
> notice: Finished catalog run in 16.23 seconds
> root@puppet-1306413279:~# cat /tmp/puppet.test 

what does your file resource and template definition for /tmp/puppet.test look 
like.

the following module snippets are working:

class mytest {
        file "/tmp/puppet.test":
                content => template("mytest/puppet.test.erb")
        }
}

cat template/puppet.test.erb
Certname: <%= certname %>

cat /tmp/puppet.test
Certname: localhost.localdomain

> 
> Certname:
> (empty string)
> 
> --
> 
> As you can see, I get no output. This is the code of my "certname" fact:
> 
> require 'facter'
> 
> Facter.add("certname") do
>     setcode do
>         %x{/usr/bin/puppet --configprint certname}.chomp
>     end
> end
> 
> --
> 
> Could you please tell me where is the problem?
> 
> Thank you verymuch,
> Matteo
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to