4

Given that the following is config'd in my Vagrantfile:

puppet.facter = {
  'variableOne' => 'one',
  'variableTwo' => 'two'
}

... and the following is in the manifest:

notify{ "Got here with ${variableOne} and ${variableTwo}":}

When I run vagrant up (or vagrant provision if it's already up) I see the following line in the output:

==> default: Notice: Got here with and

and when I add --debug to the vagrant command, I also see this in the output:

==> default: Running Puppet with default.pp...
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: FACTER_variableOne='one' FACTER_variableTwo='two' puppet apply --verbose --debug --manifestdir /tmp/vagrant-puppet-3/manifests --detailed-exitcodes /tmp/vagrant-puppet-3/manifests/default.pp (sudo=true)

Why aren't the variables getting populated in the manifest?

Example repo to reproduce: https://github.com/ericsmalling/vagrantpuppet

2

Thanks to @SebastianWeigand, a coworker of mine, I've found that the use of cammel-case in the variable names was causing the problem. Switching to "variableone" and "variabletwo" in both sides fixed it.

0

Maybe your notify is within a namespace. Can you try to access the facter variables in top scope via:

notify{ "Got here with ${::variableOne} and ${::variableTwo}":}
  • Thanks, but that did not work either. A coworker of fine found that eliminating camel-case in variable names seems to have fixed it though. (see my self-posted answer) – Eric Smalling Dec 11 '14 at 22:19
  • This was a possible issue in Puppet 2.7.x and older. In 3.x, you could only achieve shadowing by explicitly overriding the values in the manifest (outside any class, in the node block if used, or in the class/define that tries to access the values). – Felix Frank Dec 15 '14 at 16:46

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.