When we moved code from the compiler to parser/resource, we lost
a conditional that prevented defined resources from gaining containment
edges to stages. Adding a stage to a defined resource was usually
harmless, but it violated the invariant of "resources should only have
exactly one container as their direct parent", producing a 50% chance of
a malformed containment path in log messages.

Reviewed-By: Jacob Helwig <[email protected]>
Signed-off-by: Jesse Wolfe <[email protected]>
---
 lib/puppet/parser/resource.rb |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb
index b98bc0b..e4f9130 100644
--- a/lib/puppet/parser/resource.rb
+++ b/lib/puppet/parser/resource.rb
@@ -66,6 +66,8 @@ class Puppet::Parser::Resource < Puppet::Resource
   # is drawn from  the class to the stage.   The stage for containment
   # defaults to main, if none is specified.
   def add_edge_to_stage
+    return unless self.type.to_s.downcase == "class"
+
     unless stage = catalog.resource(:stage, self[:stage] || (scope && 
scope.resource && scope.resource[:stage]) || :main)
       raise ArgumentError, "Could not find stage #{self[:stage] || :main} 
specified by #{self}"
     end
-- 
1.7.3.5

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" 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-dev?hl=en.

Reply via email to