summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-01-30 19:22:25 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-01-30 19:22:25 +0000
commit4ada6aff0bfe2d63f7b73f85140a37345638cba9 (patch)
tree648cd4c017699b51463153415e329373bd5464ee /lib/puppet/parser
parent8db35eccb090889cdf9ba0989140a91401d31c5a (diff)
downloadpuppet-4ada6aff0bfe2d63f7b73f85140a37345638cba9.tar.gz
puppet-4ada6aff0bfe2d63f7b73f85140a37345638cba9.tar.xz
puppet-4ada6aff0bfe2d63f7b73f85140a37345638cba9.zip
Fixing class storage -- it was not working for nodescopes
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@858 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/interpreter.rb12
-rw-r--r--lib/puppet/parser/scope.rb22
2 files changed, 19 insertions, 15 deletions
diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb
index 942c417a2..7bb9f6b3b 100644
--- a/lib/puppet/parser/interpreter.rb
+++ b/lib/puppet/parser/interpreter.rb
@@ -68,22 +68,14 @@ module Puppet
end
# We've already evaluated the AST, in this case
- retval = @scope.evalnode(names, facts)
- if classes = @scope.classlist
- retval.classes = classes
- end
- return retval
+ return @scope.evalnode(names, facts)
else
# We've already evaluated the AST, in this case
@scope = Puppet::Parser::Scope.new() # no parent scope
@scope.interp = self
@scope.type = "puppet"
@scope.name = "top"
- retval = @scope.evaluate(@ast, facts, @classes)
- if classes = @scope.classlist
- retval.classes = classes + @classes
- end
- return retval
+ return @scope.evaluate(@ast, facts, @classes)
end
#@ast.evaluate(@scope)
rescue Puppet::DevError, Puppet::Error, Puppet::ParseError => except
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index c2c59fc5a..9392d6cf9 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -195,16 +195,21 @@ module Puppet
# cache the results, but it's not worth it at this stage.
# Note that we evaluate the node code with its containing
- # scope, not with the top scope.
- code.safeevaluate(scope, facts)
+ # scope, not with the top scope. We also retrieve the created
+ # nodescope so that we can get any classes set within it
+ nodescope = code.safeevaluate(scope, facts)
# We don't need to worry about removing the Node code because
# it will be removed during translation.
- # And now return the whole thing
- #return self.to_trans
+ # convert the whole thing
objects = self.to_trans
+ # Add any evaluated classes to our top-level object
+ unless nodescope.classlist.empty?
+ objects.classes = nodescope.classlist
+ end
+
# I should do something to add the node as an object with tags
# but that will possibly end up with far too many tags.
#self.logtags
@@ -256,7 +261,14 @@ module Puppet
end
}
- return self.to_trans
+ objects = self.to_trans
+
+ # Add our class list
+ unless self.classlist.empty?
+ objects.classes = self.classlist
+ end
+
+ return objects
end
# Initialize our new scope. Defaults to having no parent and to