diff options
author | Richard Soderberg <rs@pi007.sv2.upperbeyond.com> | 2009-08-24 19:57:07 -0700 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-11-20 08:07:52 +1100 |
commit | c9f40be6c567d8de328b9d79dde357672323925a (patch) | |
tree | 1ed7730149eb8ac9efc26c96934ff7dfda903a5e /lib/puppet | |
parent | 2d137e2e1ce603ee2727d66b1aba57458bf4d1be (diff) | |
download | puppet-c9f40be6c567d8de328b9d79dde357672323925a.tar.gz puppet-c9f40be6c567d8de328b9d79dde357672323925a.tar.xz puppet-c9f40be6c567d8de328b9d79dde357672323925a.zip |
Fixed #2568 - Add database option 'dbconnections'
This sets the ActiveRecords connection pool size, when connecting to remote databases (mysql, postgres). default is 0; the 'pool' argument is only passed to ActiveRecords when the value is 1 or greater.
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/defaults.rb | 3 | ||||
-rw-r--r-- | lib/puppet/rails.rb | 14 |
2 files changed, 13 insertions, 4 deletions
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 |