[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

James Turnbull james at lovedthanlost.net
Wed Jul 14 10:29:34 UTC 2010


The following commit has been merged in the upstream branch:
commit c9f40be6c567d8de328b9d79dde357672323925a
Author: Richard Soderberg <rs at pi007.sv2.upperbeyond.com>
Date:   Mon Aug 24 19:57:07 2009 -0700

    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.

diff --git a/ext/puppetstoredconfigclean.rb b/ext/puppetstoredconfigclean.rb
index 439d743..978e083 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 ef194bc..9d992dd 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 ec2d618..c941d8f 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 21c94f8..75577b9 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 d838f0b..8ecd77a 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

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list