From c8b320e36652db5dac02870ecc73a62c70d5c736 Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Mon, 25 Feb 2008 11:51:06 +1100 Subject: Corrected #1040 fix - this should now be right - trace was after raise --- lib/puppet/parser/interpreter.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index 33f66e8c2..d4655c403 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -28,10 +28,8 @@ class Puppet::Parser::Interpreter begin return Puppet::Parser::Compiler.new(node, env_parser).compile rescue => detail + puts detail.backtrace if Puppet[:trace] raise Puppet::Error, detail.to_s + " on node %s" % node.name - if Puppet[:trace] - puts detail.backtrace - end end end -- cgit From 125851278d745e443c0598fbb0577b010f824365 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Mon, 25 Feb 2008 19:40:44 -0500 Subject: Fixing #1084 -- the node catalog asks the individual resources whether they're isomorphic, and they in turn ask the resource types (or default to true for defined resource types). --- lib/puppet/parser/resource.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index fb0799011..46be89ca2 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -133,6 +133,15 @@ class Puppet::Parser::Resource tag(@ref.title) if valid_tag?(@ref.title.to_s) end + # Is this resource modeling an isomorphic resource type? + def isomorphic? + if builtin? + return @ref.builtintype.isomorphic? + else + return true + end + end + # Merge an override resource in. This will throw exceptions if # any overrides aren't allowed. def merge(resource) -- cgit From 42bfdf2fc7affa91265043e583c9673b738d22dd Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Mon, 25 Feb 2008 19:53:24 -0500 Subject: Fixing #1085, I think -- I was not returning a resource if the class had already been evaluated, but this was only being run into in corner cases -- mostly where one class included another class, I assume. --- lib/puppet/parser/ast/definition.rb | 3 --- lib/puppet/parser/ast/hostclass.rb | 9 ++++++++- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/ast/definition.rb b/lib/puppet/parser/ast/definition.rb index 2b7506446..0c65c702c 100644 --- a/lib/puppet/parser/ast/definition.rb +++ b/lib/puppet/parser/ast/definition.rb @@ -24,9 +24,6 @@ class Puppet::Parser::AST::Definition < Puppet::Parser::AST::Branch # Create a resource that knows how to evaluate our actual code. def evaluate(scope) - # Do nothing if the resource already exists; this provides the singleton nature classes need. - return if scope.catalog.resource(self.class.name, self.classname) - resource = Puppet::Parser::Resource.new(:type => self.class.name, :title => self.classname, :scope => scope, :source => scope.source) scope.catalog.tag(*resource.tags) diff --git a/lib/puppet/parser/ast/hostclass.rb b/lib/puppet/parser/ast/hostclass.rb index 8d4d01660..7f89f8151 100644 --- a/lib/puppet/parser/ast/hostclass.rb +++ b/lib/puppet/parser/ast/hostclass.rb @@ -21,7 +21,14 @@ class Puppet::Parser::AST::HostClass < Puppet::Parser::AST::Definition # Make sure our parent class has been evaluated, if we have one. def evaluate(scope) if parentclass and ! scope.catalog.resource(self.class.name, parentclass) - resource = parentobj.evaluate(scope) + parent_resource = parentobj.evaluate(scope) + end + + # Do nothing if the resource already exists; this makes sure we don't + # get multiple copies of the class resource, which helps provide the + # singleton nature of classes. + if resource = scope.catalog.resource(self.class.name, self.classname) + return resource end super -- cgit