Issue #14402 has been updated by Gary Wilson (@earthgecko).

And `$zpf-controller::ec2_cert` works as well :)

There are topscope and non-namespaced variables in the erb templates and these 
still work dynamically and puppet-master is **not warning** about them.

Is it to be assumed that the namespacing and scope of variables in the erb 
templating context are affected in the same manner by the changes to variable 
scoping and make many existing variables in pre 2.7 templates "Out of scope" 
variables in 2.8?

So the best fix for templates using dynamic lookup would be to use the 
`scope.lookupvar` methodology with namespaced variables on all affected vars 
and templates, e.g. `<%= scope.lookupvar('zpf-controller::ec2_cert') %>` or is 
the `scope.lookupvar` function not affected by the variable and scoping changes?
----------------------------------------
Bug #14402: variable interpolation and scope
https://projects.puppetlabs.com/issues/14402#change-62540

Author: Gary Wilson (@earthgecko)
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 2.7.14
Keywords: 
Branch: 


I am somewhat lost in the changes in variable interpolation, the deprecation of 
dynamic lookup and the styling guide documentation vs Scope and Puppet 
documentation (http://docs.puppetlabs.com/guides/scope_and_puppet.html) and Bug 
#10146: Puppet interpolates variables differently in 2.7.x 
(https://projects.puppetlabs.com/issues/10146)

So with 2.7.x variables should be declared as `"/root/.ssh/${var}"` according 
to #10146 (to be safe).

The following variable worked with dynamic lookup.

<pre>
  file { "/root/.ssh/${ec2_cert}":
    source => "/opt/keys/controller_keys/${ec2_cert}",
</pre>

Variables were reworked so not just `$var` but to `${var}` to be safe as #10146.
However changing the variables to namespace variables due to dynamic lookup 
deprecation on 2.7.14 the following does not work.

<pre>
  file { "/root/.ssh/${zpf-controller:ec2_cert}":
    source => "/opt/keys/controller_keys/${zpf-controller:ec2_cert}",
</pre>

Errors with the following:

<pre>
May 10 16:19:51 zpf-controller-dev-1-10g-ruk puppet-master[20240]: Syntax error 
at ':'; expected '}' at /etc/puppet/modules/zpf/manifests/init.pp:264 on node 
zpf-controller-dev-2-512m-c4l
</pre>

So the variables are not being interpolated in the curly brackets.
However this does work.

<pre>
  file { "/root/.ssh/$zpf-controller:ec2_cert":
    source => "/opt/keys/controller_keys/$zpf-controller:ec2_cert",
</pre>

Does this mean that you cannot "curly bracket" namespace variables?  Is this a 
bug or another **significant** change in the variable interpolation changes 
that come with 2.7.x?


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to puppet-bugs@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-bugs+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to