summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-11-20 17:48:34 -0600
committerLuke Kanies <luke@madstop.com>2007-11-20 17:48:34 -0600
commitcca613d0f142e492aab8cb58087e2a6299334f7d (patch)
tree5faf5e57ee81dc3ae20e7cc117487c2f78ab0a29 /lib/puppet
parent96b3cde842a9efa3fbd8226c6f044a6e18c612d0 (diff)
downloadpuppet-cca613d0f142e492aab8cb58087e2a6299334f7d.tar.gz
puppet-cca613d0f142e492aab8cb58087e2a6299334f7d.tar.xz
puppet-cca613d0f142e492aab8cb58087e2a6299334f7d.zip
Fixing the first part of #787. Not all collections were
being evaluated on the first pass because they were being deleted from the collections list during evaluation, which caused some to get skipped. This commit fixes that problem, which helps in the trivial cases where the collections are in the same scope. I expect it's still broken for more complicated usages.
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/parser/compile.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/puppet/parser/compile.rb b/lib/puppet/parser/compile.rb
index 7f568f1b3..93ba180a7 100644
--- a/lib/puppet/parser/compile.rb
+++ b/lib/puppet/parser/compile.rb
@@ -269,10 +269,11 @@ class Puppet::Parser::Compile
found_something = false
exceptwrap do
- @collections.each do |collection|
- if collection.evaluate
- found_something = true
- end
+ # We have to iterate over a dup of the array because
+ # collections can delete themselves from the list, which
+ # changes its length and causes some collections to get missed.
+ @collections.dup.each do |collection|
+ found_something = true if collection.evaluate
end
end