[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.25.4-2-17-g9ce2bcf

Micah Anderson micah at riseup.net
Mon Apr 5 22:23:28 UTC 2010


The following commit has been merged in the master branch:
commit 9ce2bcf2ce365bfeba4d38a7d04dc560deb29742
Author: Micah Anderson <micah at riseup.net>
Date:   Mon Apr 5 18:20:08 2010 -0400

    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.
    
    Note: This was cherry-picked from
    c9f40be6c567d8de328b9d79dde357672323925a from upstream/master. This
    fix is currently targetted for rowlf. There was one hunk that touched
    a part of the code that is not in 0.25, which is adding support for
    'oracle_enhanced' It is a trivial hunk, related to code that is not in
    0.25, so I removed it to complete the merge.

diff --git a/debian/changelog b/debian/changelog
index 90548e9..f9bf286 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,8 @@ puppet (0.25.4-4) UNRELEASED; urgency=low
   [ Micah Anderson ]
   * add Suggests: libselinux-ruby1.8 as puppet supports it, but only
     if the library is present
+  * cherry-pick: add puppetmasterd dbconnections option to increase 
+    the rails 'max pool size' (redmine: #2568)
 
  -- Micah Anderson <micah at debian.org>  Sun, 04 Apr 2010 22:24:05 -0400
 
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 21cee7a..736fbee 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -678,6 +678,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 98c0e3d..d3cd148 100644
--- a/lib/puppet/rails.rb
+++ b/lib/puppet/rails.rb
@@ -58,6 +58,9 @@ module Puppet::Rails
 
             socket          = Puppet[:dbsocket]
             args[:socket]   = socket unless socket.empty?
+	        
+            connections     = Puppet[:dbconnections].to_i
+            args[:pool]     = connections if connections > 0 
         else
             raise ArgumentError, "Invalid db adapter %s" % adapter
         end
diff --git a/spec/unit/rails.rb b/spec/unit/rails.rb
index f61288f..f9cac35 100755
--- a/spec/unit/rails.rb
+++ b/spec/unit/rails.rb
@@ -85,6 +85,28 @@ describe Puppet::Rails, "when initializing a sqlite3 connection" do
             :database  => "testlocation"
         }
     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 mysql or postgresql connection" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list