Issue #5129 has been updated by Nigel Kersten. Status changed from Unreviewed to Accepted
---------------------------------------- Bug #5129: functions are able to change puppet variables https://projects.puppetlabs.com/issues/5129 Author: Peter Meier Status: Accepted Priority: Normal Assignee: Category: Target version: Affected Puppet version: 2.6.2 Keywords: Branch: While playing around with functions I found out the following: <pre> $ facter | grep puppet puppetversion => 2.6.2 $ cat lib/puppet/parser/functions/array_del.rb Puppet::Parser::Functions::newfunction( :array_del, :type => :rvalue, :doc => "Deletes items from an array Example: array_del(['a','b'],'b') -> ['a']" ) do |args| raise Puppet::ParseError, 'array_del() needs two arguments' if args.length != 2 args[0].to_a.delete(args[1]) args[0] end $ cat test.pp $a = ['a','b','c'] $b = array_del($a,'b') notice $b notice $a $ RUBYLIB=lib/ puppet test.pp notice: Scope(Class[main]): a c notice: Scope(Class[main]): a c </pre> After some discussion on IRC with Volcane I decided to report this behavior. I'm not really sure whether this should actually be possible. This might be related to #4370, but actually things are in my case also slightly different. Workaround: args[0].dup.to_a... -- 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.
