summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/resource.rb
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2010-07-23 17:04:22 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-25 22:24:28 -0700
commit9778f2a47922a66e59d571c1c98552223a817ce1 (patch)
tree4695f33d8710a0c8c09551a12513412c5f545107 /lib/puppet/parser/resource.rb
parent59a23d69c20a8ab1f7dc9ff1d109305f9027641c (diff)
downloadpuppet-9778f2a47922a66e59d571c1c98552223a817ce1.tar.gz
puppet-9778f2a47922a66e59d571c1c98552223a817ce1.tar.xz
puppet-9778f2a47922a66e59d571c1c98552223a817ce1.zip
[#4242] Fixed recursion due to parents including their children
Resources mark themselves as evaluated to prevent being evaluated again. Unfortunately, they were not marking themselves until after they had finished being completely evaluated. Thus, there was nothing actually stopping recursive evaluations. This patch just makes resources mark themselves as evaluated when they start evaluating, and adds tests. The original setting of evaluated was done in an ensure block, so this doesn't change the behavior of a resource which fails to evaluate. The only places evaluated? is checked aren't affected by this change, as they wouldn't want to evaluate it when it's already being evaluated anyway.
Diffstat (limited to 'lib/puppet/parser/resource.rb')
-rw-r--r--lib/puppet/parser/resource.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb
index c956a1106..3c451929e 100644
--- a/lib/puppet/parser/resource.rb
+++ b/lib/puppet/parser/resource.rb
@@ -64,6 +64,7 @@ class Puppet::Parser::Resource < Puppet::Resource
# Retrieve the associated definition and evaluate it.
def evaluate
+ @evaluated = true
if klass = resource_type and ! builtin_type?
finish
return klass.evaluate_code(self)
@@ -72,8 +73,6 @@ class Puppet::Parser::Resource < Puppet::Resource
else
self.fail "Cannot find definition #{type}"
end
- ensure
- @evaluated = true
end
# Mark this resource as both exported and virtual,