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

Eric Smalling
  • 183
  • 1
  • 8

2 Answers2

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.

Eric Smalling
  • 183
  • 1
  • 8
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}":}
edlerd
  • 806
  • 8
  • 12
  • 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](https://docs.puppetlabs.com/learning/variables.html#aside-why-do-everyones-manifests-seem-to-use-ipaddress) 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