Ask Your Question
0

Puppet loose facter?

asked 2015-03-02 06:53:45 -0500

Alexander Demchenko gravatar image

updated 2015-03-04 18:07:59 -0500

GregLarkin gravatar image

When i run puppet agent -t, Puppet can't see facts. I see error: uninitialized constant Facter::Core

In manifest i have this code: notify {"$operatingsystem - $operatingsystemrelease":}

And, when i run puppet agent, i get: Notify[ - ]/message: defined 'message' as ' - '

On the same server:

/opt/csw/bin/facter | grep operatingsystem
operatingsystem => Solaris
operatingsystemrelease => 5.10
edit retag flag offensive close merge delete

Comments

What happens when you run the commands "/opt/csw/bin/puppet apply -e 'notice($operatingsystem)'" and "/opt/csw/bin/puppet apply -e 'notice($operatingsystemrelease)'"? If that fails, replace "$" with "$::" in the variable names and try again. Does that work?

GregLarkin gravatar imageGregLarkin ( 2015-03-04 18:10:06 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-03-04 13:59:04 -0500

mckownam gravatar image

updated 2015-03-04 13:59:20 -0500

Try

notify { "${::operatingsystem} - ${::operatingsystemrelease}": }

The $::variableName format is necessary for using facter facts. $variableName is just a local fact for that class/module.

edit flag offensive delete link more

Comments

Technically, you can use the form without the "::" to refer to facts, as long as there is no variable name collision in a more local scope. Due to that possibility, it's extremely good practice to get in the habit of using "::" to access fact values, so it's nice to see that pointed out!

GregLarkin gravatar imageGregLarkin ( 2015-03-04 18:11:54 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2015-03-02 06:53:45 -0500

Seen: 126 times

Last updated: Mar 04 '15