On Thu, Jul 5, 2012 at 2:41 PM, jcbollinger <john.bollin...@stjude.org> wrote: > > > On Thursday, July 5, 2012 2:59:07 PM UTC-5, fpee wrote: >> >> On 07/05/2012 08:30 AM, jcbollinger wrote: >> >> > If that's so then you are relying on a Puppet bug, or perhaps you have >> > oversimplified your example. The language guide specifically states >> > that the += operator affects the observed value of the affected variable >> > only in the scope where the plussignment is performed. You definitely >> > should not see the modified value in classes that are not declared in >> > the scope of the plussignment. >> >> Cool! Let's find out. Here is a working tiny example: >> >> node my_standard { >> $pkg_list += 'one two three ' >> } >> >> node 'testnode' inherits my_standard { >> include my_test1 >> include my_test2 >> } >> >> class my_test1 { >> $pkg_list += 'four five ' >> notify {"pkg_list=$pkg_list":} >> notice("pkg_list=$pkg_list") >> } >> >> class my_test2 { >> $pkg_list += 'six seven ' >> notify {"pkg_list=$pkg_list":} >> notice("pkg_list=$pkg_list") >> } >> >> The output when run on testnode: >> >> notice: /Stage[main]/My_test1/Notify[pkg_list=one two three four five >> ]/message: defined 'message' as 'pkg_list=one two three four five ' >> >> notice: /Stage[main]/My_test2/Notify[pkg_list=one two three four five >> six seven ]/message: defined 'message' as 'pkg_list=one two three four >> five six seven ' >> >> So, the my_test2 scope does have the changes from the my_test1 scope. >> Using puppet-server 2.7.9-1 (epel version). >> >> As the guy who has many modules that use this bug, I like it's >> functionality :) >> >> Should I file a bug report? > > > Not if you like the buggy behavior :-) > > Personally, I would be very concerned that it might stop working between one > point release and another, with no warning. The behavior is not merely > undocumented, but contrary to the documentation as far as I can tell. > > At this point, however, I'm hoping that one of the PuppetLabs guys will jump > in to either explain why I'm wrong or confirm that it's a bug.
This is not an official Puppet Labs opinion. This seems to be compilation order dependent, so you will have different notify for: include my_test1 include my_test2 v.s. include my_test2 include my_test1 Also at a quick glance I can't see how you would use this in Puppet 3.0 with dynamic scope removed. Nan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.