diff options
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/parser/interpreter.rb | 12 | ||||
-rw-r--r-- | lib/puppet/parser/scope.rb | 22 | ||||
-rw-r--r-- | lib/puppet/transaction.rb | 2 | ||||
-rw-r--r-- | lib/puppet/util.rb | 3 |
4 files changed, 22 insertions, 17 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 diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index 8caa28588..0cf13a9e1 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -44,7 +44,7 @@ class Transaction Puppet.debug "Beginning transaction %s with %s changes" % [self.object_id, @changes.length] - now = Time.now.to_i + now = Time.now events = @changes.collect { |change| if change.is_a?(Puppet::StateChange) change.transaction = self diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb index 9974d55e3..669e8310a 100644 --- a/lib/puppet/util.rb +++ b/lib/puppet/util.rb @@ -91,7 +91,8 @@ module Util while File.exists?(lock) stamp = File.stat(lock).mtime.to_i if Time.now.to_i - stamp > 5 - Puppet.notice "Lock file %s is %s seconds old; removing" + Puppet.notice "Lock file %s is %s seconds old; removing" % + [lock, Time.now.to_i - stamp] File.delete(lock) end #Puppet.debug "%s is locked" % opts[0] |