summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ext/puppetstoredconfigclean.rb2
-rw-r--r--lib/puppet/defaults.rb3
-rw-r--r--lib/puppet/rails.rb14
-rw-r--r--man/man8/puppet.conf.84
-rwxr-xr-xspec/unit/rails.rb22
5 files changed, 41 insertions, 4 deletions
diff --git a/ext/puppetstoredconfigclean.rb b/ext/puppetstoredconfigclean.rb
index 439d74376..978e08357 100644
--- a/ext/puppetstoredconfigclean.rb
+++ b/ext/puppetstoredconfigclean.rb
@@ -66,6 +66,8 @@ case adapter
args[:database] = pm_conf[:dbname] unless pm_conf[:dbname].to_s.empty?
socket = pm_conf[:dbsocket]
args[:socket] = socket unless socket.to_s.empty?
+ connections = pm_conf[:dbconnections].to_i
+ args[:pool] = connections if connections > 0
else
raise ArgumentError, "Invalid db adapter %s" % adapter
end
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index ef194bc31..9d992dd74 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -655,6 +655,9 @@ module Puppet
used when networked databases are used."],
:dbsocket => [ "", "The database socket location. Only used when networked
databases are used. Will be ignored if the value is an empty string."],
+ :dbconnections => [ 0, "The number of database connections. Only used when
+ networked databases are used. Will be ignored if the value is an empty
+ string or is less than 1."],
:railslog => {:default => "$logdir/rails.log",
:mode => 0600,
:owner => "service",
diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb
index ec2d618fa..c941d8f3d 100644
--- a/lib/puppet/rails.rb
+++ b/lib/puppet/rails.rb
@@ -51,10 +51,16 @@ module Puppet::Rails
socket = Puppet[:dbsocket]
args[:socket] = socket unless socket.empty?
- when "oracle_enhanced":
- args[:database] = Puppet[:dbname] unless Puppet[:dbname].empty?
- args[:username] = Puppet[:dbuser] unless Puppet[:dbuser].empty?
- args[:password] = Puppet[:dbpassword] unless Puppet[:dbpassword].empty?
+
+ connections = Puppet[:dbconnections].to_i
+ args[:pool] = connections if connections > 0
+ when "oracle_enhanced":
+ args[:database] = Puppet[:dbname] unless Puppet[:dbname].empty?
+ args[:username] = Puppet[:dbuser] unless Puppet[:dbuser].empty?
+ args[:password] = Puppet[:dbpassword] unless Puppet[:dbpassword].empty?
+
+ connections = Puppet[:dbconnections].to_i
+ args[:pool] = connections if connections > 0
else
raise ArgumentError, "Invalid db adapter %s" % adapter
end
diff --git a/man/man8/puppet.conf.8 b/man/man8/puppet.conf.8
index 21c94f802..75577b9aa 100644
--- a/man/man8/puppet.conf.8
+++ b/man/man8/puppet.conf.8
@@ -588,6 +588,10 @@ The type of database to use.
Default: sqlite3
+.SS dbconnections
+The number of database connections. Only used when networked databases are used. Will be ignored if the value is an empty string or is less than 1.
+
+
.SS dblocation
The database cache for client configurations. Used for querying within the language.
diff --git a/spec/unit/rails.rb b/spec/unit/rails.rb
index d838f0b8f..8ecd77a49 100755
--- a/spec/unit/rails.rb
+++ b/spec/unit/rails.rb
@@ -117,6 +117,28 @@ describe Puppet::Rails, "when initializing a mysql connection" do
:socket => "testsocket"
}
end
+
+ it "should provide the adapter, log_level, and host, username, password, database, socket, and connections 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")
+ Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
+ Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
+ Puppet.settings.stubs(:value).with(:dbname).returns("testname")
+ Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
+ Puppet.settings.stubs(:value).with(:dbconnections).returns(1)
+
+ Puppet::Rails.database_arguments.should == {
+ :adapter => "mysql",
+ :log_level => "testlevel",
+ :host => "testserver",
+ :username => "testuser",
+ :password => "testpassword",
+ :database => "testname",
+ :socket => "testsocket",
+ :pool => 1
+ }
+ end
end
describe Puppet::Rails, "when initializing a postgresql connection" do