Ask Your Question

Puppet loose facter?

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

Alexander Demchenko gravatar image

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

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


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 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

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

mckownam gravatar image

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


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


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 -0600 )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


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

Seen: 169 times

Last updated: Mar 04 '15