diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-01-03 19:45:52 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-01-03 19:45:52 +0000 |
commit | 9115fefb1a615e3d918c3eaa266135a651be17eb (patch) | |
tree | 4dfab37eba2d041fdf4f96d64cd21112c4544217 | |
parent | 0ef89715c590137299e89496bf6ee09d97a8b2b2 (diff) | |
download | puppet-9115fefb1a615e3d918c3eaa266135a651be17eb.tar.gz puppet-9115fefb1a615e3d918c3eaa266135a651be17eb.tar.xz puppet-9115fefb1a615e3d918c3eaa266135a651be17eb.zip |
Adding extra connection statements and enabling concurrency support in rails, hopefully fixing #399.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2027 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | lib/puppet/parser/collector.rb | 3 | ||||
-rw-r--r-- | lib/puppet/parser/interpreter.rb | 4 | ||||
-rw-r--r-- | lib/puppet/rails.rb | 1 | ||||
-rw-r--r-- | lib/puppet/rails/resource.rb | 2 |
4 files changed, 8 insertions, 2 deletions
diff --git a/lib/puppet/parser/collector.rb b/lib/puppet/parser/collector.rb index 8b7df8c78..d64e76132 100644 --- a/lib/puppet/parser/collector.rb +++ b/lib/puppet/parser/collector.rb @@ -17,6 +17,9 @@ class Puppet::Parser::Collector # We're going to collect objects from rails, but we don't want any # objects from this host. + unless ActiveRecord::Base.connected? + Puppet::Rails.init + end host = Puppet::Rails::Host.find_by_name(@scope.host) args = {} diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index ad2487f11..a00b10042 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -778,7 +778,9 @@ class Puppet::Parser::Interpreter "storeconfigs is enabled but rails is unavailable" end - Puppet::Rails.init + unless ActiveRecord::Base.connected? + Puppet::Rails.init + end # Fork the storage, since we don't need the client waiting # on that. How do I avoid this duplication? diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb index 8ec02af7c..28f2b8584 100644 --- a/lib/puppet/rails.rb +++ b/lib/puppet/rails.rb @@ -60,6 +60,7 @@ module Puppet::Rails Puppet.config.use(:puppet) ActiveRecord::Base.logger = Logger.new(Puppet[:railslog]) + ActiveRecord::Base.allow_concurrency = true begin ActiveRecord::Base.establish_connection(database_arguments()) diff --git a/lib/puppet/rails/resource.rb b/lib/puppet/rails/resource.rb index bb36f161b..6656c2450 100644 --- a/lib/puppet/rails/resource.rb +++ b/lib/puppet/rails/resource.rb @@ -16,7 +16,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base def tags=(tags) tags.each do |tag| self.tag_with tag - end + end end def file=(file) |