Issue #4536 has been updated by Markus Roberts.

Target version set to queued

I switched the use of foo & bar around in your example to show the effect, from 
the original:

<pre>
$foo = [1, 2]
notice("bar is $bar")  # 'bar is 12'
$bar = inline_template('<% foo.shift %>')
notice("bar is $bar")  # 'bar is 2'
</pre>

to:

<pre>
$bar = [1,2]
notice("bar is $bar")  # 'bar is 12'
$foo = inline_template('<% bar.shift%>')
notice("bar is $bar")  # 'bar is 2'
</pre>

----------------------------------------
Refactor #4536: scope.lookupvar should return a clone of the object, not the 
object itself
http://projects.puppetlabs.com/issues/4536

Author: Daniel Pittman
Status: Needs design decision
Priority: Low
Assigned to: 
Category: functions
Target version: queued
Affected version: 0.25.5
Branch: 


At present this code will destroy the content of a puppet variable:

<pre>
$bar = [1,2]
notice("bar is $bar")  # 'bar is 12'
$foo = inline_template('<% bar.shift%>')
notice("bar is $bar")  # 'bar is 2'
</pre>

This is certainly surprising behaviour, and it means that it is relatively easy 
to destroy the content of a puppet variable from a template.

This would probably be better returning a clone of the object so, at least, 
that the most obvious top level actions don't destroy the content so easily.  
Perhaps even a dclone is appropriate...


-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to