diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2009-12-17 14:47:19 -0800 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-12-20 09:29:40 +1100 |
commit | b86decc0ea274eb6d9ffa3170fd4ec81d735519f (patch) | |
tree | 8c11395beff3ea8d733fa45048d525c9aa99a32c | |
parent | 854c06502d1a8f6d6dfaf0abeaacb4791a6fb5ed (diff) | |
download | puppet-b86decc0ea274eb6d9ffa3170fd4ec81d735519f.tar.gz puppet-b86decc0ea274eb6d9ffa3170fd4ec81d735519f.tar.xz puppet-b86decc0ea274eb6d9ffa3170fd4ec81d735519f.zip |
Fix #2816 MySQL server has gone away
As suggested in the ticket, set :reconnect to true. Our in-house Rails
experts suggest that this is unlikely to cause any problems.
The setting is silently ignored before Rails 2.3
-rw-r--r-- | lib/puppet/rails.rb | 1 | ||||
-rwxr-xr-x | spec/unit/rails.rb | 10 |
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb index 98d8297fe..98c0e3d32 100644 --- a/lib/puppet/rails.rb +++ b/lib/puppet/rails.rb @@ -54,6 +54,7 @@ module Puppet::Rails args[:username] = Puppet[:dbuser] unless Puppet[:dbuser].empty? args[:password] = Puppet[:dbpassword] unless Puppet[:dbpassword].empty? args[:database] = Puppet[:dbname] + args[:reconnect]= true socket = Puppet[:dbsocket] args[:socket] = socket unless socket.empty? diff --git a/spec/unit/rails.rb b/spec/unit/rails.rb index 03028734a..f61288f7a 100755 --- a/spec/unit/rails.rb +++ b/spec/unit/rails.rb @@ -90,7 +90,7 @@ end describe Puppet::Rails, "when initializing a mysql or postgresql connection" do confine "Cannot test without ActiveRecord" => Puppet.features.rails? - it "should provide the adapter, log_level, and host, username, password, and database arguments" do + it "should provide the adapter, log_level, and host, username, password, database, and reconnect arguments" do Puppet.settings.stubs(:value).with(:dbadapter).returns("mysql") Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel") Puppet.settings.stubs(:value).with(:dbserver).returns("testserver") @@ -105,11 +105,12 @@ describe Puppet::Rails, "when initializing a mysql or postgresql connection" do :host => "testserver", :username => "testuser", :password => "testpassword", - :database => "testname" + :database => "testname", + :reconnect => true } end - it "should provide the adapter, log_level, and host, username, password, database, and socket arguments" do + it "should provide the adapter, log_level, and host, username, password, database, socket, and reconnect arguments" do Puppet.settings.stubs(:value).with(:dbadapter).returns("mysql") Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel") Puppet.settings.stubs(:value).with(:dbserver).returns("testserver") @@ -125,7 +126,8 @@ describe Puppet::Rails, "when initializing a mysql or postgresql connection" do :username => "testuser", :password => "testpassword", :database => "testname", - :socket => "testsocket" + :socket => "testsocket", + :reconnect => true } end end |