Issue #14197 has been updated by Daniel Pittman. Status changed from Unreviewed to Needs Decision Assignee set to Pieter van de Bruggen
Cristian, you are absolutely right: variables are processed in order, and are neither declarative nor lazy. We recently had some informal discussion about this internally; Pieter is the person here who is taking charge of longer term decisions about these issues, so I am handing this to him to decide if we should deliver on our promise, or promise what we deliver. For now you will have to declare variables before you use them, I fear. Personally, I stand very strongly on the side that we should treat them as declarative, or lazy-evaluated, and that code should work with either value of the variable being set - before or after it is consumed. ---------------------------------------- Bug #14197: variable assignment is not behaving declaratively in case of definitions https://projects.puppetlabs.com/issues/14197#change-61510 Author: Cristian Măgherușan-Stanciu Status: Needs Decision Priority: Normal Assignee: Pieter van de Bruggen Category: compiler Target version: Affected Puppet version: 2.6.7 Keywords: Branch: See the following example: define bla() { exec { "${name}": command => "/usr/bin/touch ${name}", } } #the code works if you enable the next line #$letters = ['A','B'] $files = $letters bla { $files: } #compilation fails if this line is enabled #$letters = ['A','B'] Expected behavior: The code should work the same in both cases. We have an ENC and it can also be reproduced, since it behaves as if the variables were assigned at the end of the Puppet code. This was observed initially on version 2.6.7 but 2.7.1 is also broken. -- 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.
