| 1 | diff --git a/ext/puppetstoredconfigclean.rb b/ext/puppetstoredconfigclean.rb
|
| 2 | index 439d743..978e083 100644
|
| 3 | --- a/ext/puppetstoredconfigclean.rb
|
| 4 | +++ b/ext/puppetstoredconfigclean.rb
|
| 5 | @@ -66,6 +66,8 @@ case adapter
|
| 6 | args[:database] = pm_conf[:dbname] unless pm_conf[:dbname].to_s.empty?
|
| 7 | socket = pm_conf[:dbsocket]
|
| 8 | args[:socket] = socket unless socket.to_s.empty?
|
| 9 | + connections = pm_conf[:dbconnections].to_i
|
| 10 | + args[:pool] = connections if connections > 0
|
| 11 | else
|
| 12 | raise ArgumentError, "Invalid db adapter %s" % adapter
|
| 13 | end
|
| 14 | diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
|
| 15 | index ef194bc..9d992dd 100644
|
| 16 | --- a/lib/puppet/defaults.rb
|
| 17 | +++ b/lib/puppet/defaults.rb
|
| 18 | @@ -655,6 +655,9 @@ module Puppet
|
| 19 | used when networked databases are used."],
|
| 20 | :dbsocket => [ "", "The database socket location. Only used when networked
|
| 21 | databases are used. Will be ignored if the value is an empty string."],
|
| 22 | + :dbconnections => [ 0, "The number of database connections. Only used when
|
| 23 | + networked databases are used. Will be ignored if the value is an empty
|
| 24 | + string or is less than 1."],
|
| 25 | :railslog => {:default => "$logdir/rails.log",
|
| 26 | :mode => 0600,
|
| 27 | :owner => "service",
|
| 28 | diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb
|
| 29 | index ec2d618..9e35401 100644
|
| 30 | --- a/lib/puppet/rails.rb
|
| 31 | +++ b/lib/puppet/rails.rb
|
| 32 | @@ -51,10 +51,16 @@ module Puppet::Rails
|
| 33 |
|
| 34 | socket = Puppet[:dbsocket]
|
| 35 | args[:socket] = socket unless socket.empty?
|
| 36 | +
|
| 37 | + connections = Puppet[:dbconnections].to_i
|
| 38 | + args[:pool] = connections if connections > 0
|
| 39 | when "oracle_enhanced":
|
| 40 | args[:database] = Puppet[:dbname] unless Puppet[:dbname].empty?
|
| 41 | args[:username] = Puppet[:dbuser] unless Puppet[:dbuser].empty?
|
| 42 | args[:password] = Puppet[:dbpassword] unless Puppet[:dbpassword].empty?
|
| 43 | +
|
| 44 | + connections = Puppet[:dbconnections].to_i
|
| 45 | + args[:pool] = connections if connections > 0
|
| 46 | else
|
| 47 | raise ArgumentError, "Invalid db adapter %s" % adapter
|
| 48 | end
|
| 49 | diff --git a/man/man8/puppet.conf.8 b/man/man8/puppet.conf.8
|
| 50 | index 21c94f8..75577b9 100644
|
| 51 | --- a/man/man8/puppet.conf.8
|
| 52 | +++ b/man/man8/puppet.conf.8
|
| 53 | @@ -588,6 +588,10 @@ The type of database to use.
|
| 54 | Default: sqlite3
|
| 55 |
|
| 56 |
|
| 57 | +.SS dbconnections
|
| 58 | +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.
|
| 59 | +
|
| 60 | +
|
| 61 | .SS dblocation
|
| 62 | The database cache for client configurations. Used for querying within the language.
|
| 63 |
|
| 64 | diff --git a/spec/unit/rails.rb b/spec/unit/rails.rb
|
| 65 | index d838f0b..8ecd77a 100755
|
| 66 | --- a/spec/unit/rails.rb
|
| 67 | +++ b/spec/unit/rails.rb
|
| 68 | @@ -117,6 +117,28 @@ describe Puppet::Rails, "when initializing a mysql connection" do
|
| 69 | :socket => "testsocket"
|
| 70 | }
|
| 71 | end
|
| 72 | +
|
| 73 | + it "should provide the adapter, log_level, and host, username, password, database, socket, and connections arguments" do
|
| 74 | + Puppet.settings.stubs(:value).with(:dbadapter).returns("mysql")
|
| 75 | + Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
|
| 76 | + Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
|
| 77 | + Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
|
| 78 | + Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
|
| 79 | + Puppet.settings.stubs(:value).with(:dbname).returns("testname")
|
| 80 | + Puppet.settings.stubs(:value).with(:dbsocket).returns("testsocket")
|
| 81 | + Puppet.settings.stubs(:value).with(:dbconnections).returns(1)
|
| 82 | +
|
| 83 | + Puppet::Rails.database_arguments.should == {
|
| 84 | + :adapter => "mysql",
|
| 85 | + :log_level => "testlevel",
|
| 86 | + :host => "testserver",
|
| 87 | + :username => "testuser",
|
| 88 | + :password => "testpassword",
|
| 89 | + :database => "testname",
|
| 90 | + :socket => "testsocket",
|
| 91 | + :pool => 1
|
| 92 | + }
|
| 93 | + end
|
| 94 | end
|
| 95 |
|
| 96 | describe Puppet::Rails, "when initializing a postgresql connection" do
|