Ask Your Question

unable to pass variable in source attribute

asked 2015-06-17 06:35:43 -0500

Chutki gravatar image


I have written below manifests under /module/test_modules/test.pp to load conf file

file { '/etc/test.conf' :
      ensure => present,
      owner  => 'root',
      group  => 'root',
      mode   => '0644',
      source => "puppet:///modules/${test_modules}/test.conf",

but when I compile getting

Error: /Stage[main]/modulename/File[/etc/test.conf]: Could not evaluate: Could not retrieve information from environment test_build source(s) puppet:///modules//test.conf

why "${test_modules}" is not accepting.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-06-17 17:53:39 -0500

reidmv gravatar image

It looks like the variable is in fact being interpolated. If it weren' t, the error message would read:

Error: ... puppet:///modules/${test_modules}/test.conf

It's not though, and instead it comes back with:

Error: ... puppet:///modules//test.conf

Puppet is interpolating $test_modules, but that the variable is undefined or an empty string. This might be due to a typo, or it might be due to evaluation order dependence.

I believe that to figure out what's going wrong it would be useful to check for typos and if none are found, investigate how the value of $test_modules is being set.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2015-06-17 06:35:43 -0500

Seen: 90 times

Last updated: Jun 17 '15