diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-23 06:26:39 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-23 06:26:39 +0000 |
| commit | 2742995c0396beb9de9598b43ecde6b20b203d32 (patch) | |
| tree | c188fc3991e450a98dde09394d39ad48cdfaa851 /lib/puppet/parser/interpreter.rb | |
| parent | 85b19c4815c4e605bcfa561298786ca3c1f68de0 (diff) | |
| download | puppet-2742995c0396beb9de9598b43ecde6b20b203d32.tar.gz puppet-2742995c0396beb9de9598b43ecde6b20b203d32.tar.xz puppet-2742995c0396beb9de9598b43ecde6b20b203d32.zip | |
Fixing #343. Collections and definition evaluation both now happen on every iterative evaluation, with collections being evaluated first. This way collections can find resources that either are inside defined types or are the types themselves.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1967 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/interpreter.rb')
| -rw-r--r-- | lib/puppet/parser/interpreter.rb | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index a81b7939f..988ff478b 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -92,21 +92,36 @@ class Puppet::Parser::Interpreter initparsevars end - # Iteratively evaluate all of the objects. This finds all fo the + # Iteratively evaluate all of the objects. This finds all of the # objects that represent definitions and evaluates the definitions appropriately. # It also adds defaults and overrides as appropriate. def evaliterate(scope) count = 0 - begin - timeout 300 do - while ary = scope.unevaluated - ary.each do |resource| - resource.evaluate + loop do + count += 1 + done = true + # First perform collections, so we can collect defined types. + if coll = scope.collections and ! coll.empty? + exceptwrap do + coll.each do |c| + c.evaluate end end + done = false + end + + # Then evaluate any defined types. + if ary = scope.unevaluated + ary.each do |resource| + resource.evaluate + end + done = false + end + break if done + + if count > 1000 + raise Puppet::ParseError, "Got 1000 class levels, which is unsupported" end - rescue Timeout::Error - raise Puppet::DevError, "Got a timeout trying to evaluate all definitions" end end @@ -182,13 +197,6 @@ class Puppet::Parser::Interpreter # Now make sure we fail if there's anything left to do failonleftovers(scope) - # Now perform the collections - exceptwrap do - scope.collections.each do |coll| - coll.evaluate - end - end - # Now finish everything. This recursively calls finish on the # contained scopes and resources. scope.finish |
