From 4eb87ed7c8829a6fbc558595be9149e9b3cf5b36 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Mon, 20 Aug 2007 22:25:00 -0500 Subject: A round of bugfixing. Many more tests now pass -- I think we are largely down to tests that (yay!) fail in trunk. --- lib/puppet/parser/configuration.rb | 14 +++++++++----- lib/puppet/parser/interpreter.rb | 1 + lib/puppet/parser/resource.rb | 2 ++ lib/puppet/parser/scope.rb | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/configuration.rb b/lib/puppet/parser/configuration.rb index ddfc3606f..26553d443 100644 --- a/lib/puppet/parser/configuration.rb +++ b/lib/puppet/parser/configuration.rb @@ -77,6 +77,10 @@ class Puppet::Parser::Configuration finish() + if Puppet[:storeconfigs] + store() + end + return extract() end @@ -444,7 +448,7 @@ class Puppet::Parser::Configuration end # Store the configuration into the database. - def store(options) + def store unless Puppet.features.rails? raise Puppet::Error, "storeconfigs is enabled but rails is unavailable" @@ -456,16 +460,16 @@ class Puppet::Parser::Configuration # We used to have hooks here for forking and saving, but I don't # think it's worth retaining at this point. - store_to_active_record(options) + store_to_active_record(@node, @resource_table.values) end # Do the actual storage. - def store_to_active_record(options) + def store_to_active_record(node, resources) begin # We store all of the objects, even the collectable ones - benchmark(:info, "Stored configuration for #{options[:name]}") do + benchmark(:info, "Stored configuration for #{node.name}") do Puppet::Rails::Host.transaction do - Puppet::Rails::Host.store(options) + Puppet::Rails::Host.store(node, resources) end end rescue => detail diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index 54cd9b023..e37ef5efe 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -14,6 +14,7 @@ class Puppet::Parser::Interpreter include Puppet::Util attr_accessor :usenodes + attr_reader :parser include Puppet::Util::Errors diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index 9d3e962f0..f946c1328 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -103,6 +103,8 @@ class Puppet::Parser::Resource end end + options = symbolize_options(options) + # Set up our reference. if type = options[:type] and title = options[:title] options.delete(:type) diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index 527ed4dcd..9e6739c53 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -200,7 +200,7 @@ class Puppet::Parser::Scope end # Create a new scope and set these options. - def newscope(options) + def newscope(options = {}) configuration.newscope(self, options) end -- cgit