1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
From d55c11d0d42b1b770348b8fb6e1d4d05d607183f Mon Sep 17 00:00:00 2001
From: Richard Soderberg <rs@pi007.sv2.upperbeyond.com>
Date: Mon, 24 Aug 2009 19:57:07 -0700
Subject: [PATCH/puppet] 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.
(Cherry-picked from the 2.6.x branch -- tmz)
---
ext/puppetstoredconfigclean.rb | 2 ++
lib/puppet/defaults.rb | 3 +++
lib/puppet/rails.rb | 3 +++
man/man5/puppet.conf.5 | 7 +++++++
4 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/ext/puppetstoredconfigclean.rb b/ext/puppetstoredconfigclean.rb
index 6538192..85e1c0e 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 e446a23..6d0208b 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -683,6 +683,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..1ad602c 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/man/man5/puppet.conf.5 b/man/man5/puppet.conf.5
index ff9b889..abfa5dc 100644
--- a/man/man5/puppet.conf.5
+++ b/man/man5/puppet.conf.5
@@ -418,6 +418,13 @@ The type of database to use.
.
\fBDefault\fP: sqlite3
.UNINDENT
+.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.
+.INDENT 0.0
+.IP \(bu 2
+.
+\fBDefault\fP: 0
+.UNINDENT
.SS dblocation
.sp
The database cache for client configurations. Used for querying within the language.
--
1.7.2.1
|