summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-08-20 22:25:00 -0500
committerLuke Kanies <luke@madstop.com>2007-08-20 22:25:00 -0500
commit4eb87ed7c8829a6fbc558595be9149e9b3cf5b36 (patch)
tree5c8319949022f932eb6467b17b55debaa42fa125 /lib/puppet/parser
parent2a4e1011dbc244754f434f7eb97f3d41463e5cd4 (diff)
downloadpuppet-4eb87ed7c8829a6fbc558595be9149e9b3cf5b36.tar.gz
puppet-4eb87ed7c8829a6fbc558595be9149e9b3cf5b36.tar.xz
puppet-4eb87ed7c8829a6fbc558595be9149e9b3cf5b36.zip
A round of bugfixing. Many more tests now pass -- I think we are largely down to tests that (yay!) fail in trunk.
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/configuration.rb14
-rw-r--r--lib/puppet/parser/interpreter.rb1
-rw-r--r--lib/puppet/parser/resource.rb2
-rw-r--r--lib/puppet/parser/scope.rb2
4 files changed, 13 insertions, 6 deletions
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