From eeec8e99eaeb6bb97173f2bc04148bff3be58036 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Tue, 21 Jul 2009 17:38:57 -0700 Subject: Fixing #2423 - no more strange dependency cycles We were getting strange dependency cycles because our class structure mirrored our scope structure. We can't change the scope structure without switching from a dynamically scoped language to a lexically scoped language, which is too big of a change to make right now. Instead, I'm changing the resource graph so that all classes default to just having an edge to the 'main' graph. This will be a behaviour change for many, in that you were getting automatic dependencies from this old behaviour, but it will bring consistency. Signed-off-by: Luke Kanies --- lib/puppet/parser/compiler.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/puppet/parser/compiler.rb') diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb index 826e85a4a..2eb9438d9 100644 --- a/lib/puppet/parser/compiler.rb +++ b/lib/puppet/parser/compiler.rb @@ -39,7 +39,11 @@ class Puppet::Parser::Compiler # And in the resource graph. At some point, this might supercede # the global resource table, but the table is a lot faster # so it makes sense to maintain for now. - @catalog.add_edge(scope.resource, resource) + if resource.type.to_s.downcase == "class" and main = @catalog.resource(:class, :main) + @catalog.add_edge(main, resource) + else + @catalog.add_edge(scope.resource, resource) + end end # Do we use nodes found in the code, vs. the external node sources? -- cgit