i think everything is fine with your code.
Problem might be with location.
Dont know about PE, but for facter if you do export FACTERLIB= <you dir>,
then you can run facter to see your custom fact
On 8 Jan 2014 21:52, "Shark Laser" <[email protected]> wrote:
>
> Platform: I've downloaded and installed the learning VM. This system
> runs CentOS with Facter v1.7.3 and Puppet v3.3.1 (Puppet Enterprise
> 3.1.0).
>
> I've created a fact called hello.rb with the following content:
>
> Facter.add(:hello) do
> setcode do
> "Hello world!"
> end
> end
>
> I've placed the file in /etc/puppetlabs/facter/facts.d (I made this
> directory since the tutorial said to create it if it did not exist).
> I added a line to /etc/puppetlabs/puppet/manifests/site.pp for the default
> node: notify { $::hello: } . If I run puppet agent --test, it behaves
> as if my custom fact does not exist:
>
> Notice: undef
> Notice: /Stage[main]//Node[default]/Notify[undef]/message: defined
> 'message' as 'undef'
>
> So then the instructions said we could debug the fact by running facter
> --debug. If I do this, I see an error:
>
> Fact file /etc/puppetlabs/facter/facts.d/hello.rb was parsed but returned
> an empty data set
>
> I thought this meaningful but the same error will occur for any Facter
> custom fact I put in there. Even verbatim copy/paste jobs from known
> working examples off the tutorial. Does anyone know what is going
> on? I can't tell if the fact is in the wrong directory for Puppet when
> it uses Facter, but for some reason Facter sees it when run in
> standalone? If the latter is the case, why do I get these parse errors
> despite having valid source?
>
> Thanks for any help.
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/90578665-1151-4df5-8a46-27e03ab877d6%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/CACzr%3DFeponBw8Q3DEM3HXy9FCCDPcszp57ejNyWzSEYSq_r6KQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.