summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2010-04-23 14:32:38 +1000
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commitf0a00848d9244f03528f6cd9572989732e4b6fe2 (patch)
tree4126102732955d50274d085b019028392cf3865a
parent8b99367ccedefe0e341a79487ccea2a95f2720a3 (diff)
Fixes #3582 - Adds dbport configuration option for specifying database port
-rw-r--r--ext/puppetstoredconfigclean.rb1
-rw-r--r--lib/puppet/defaults.rb2
-rw-r--r--lib/puppet/rails.rb1
-rwxr-xr-xspec/unit/rails.rb19
4 files changed, 18 insertions, 5 deletions
diff --git a/ext/puppetstoredconfigclean.rb b/ext/puppetstoredconfigclean.rb
index 978e08357..1b4aabd0f 100644
--- a/ext/puppetstoredconfigclean.rb
+++ b/ext/puppetstoredconfigclean.rb
@@ -64,6 +64,7 @@ case adapter
args[:username] = pm_conf[:dbuser] unless pm_conf[:dbuser].to_s.empty?
args[:password] = pm_conf[:dbpassword] unless pm_conf[:dbpassword].to_s.empty?
args[:database] = pm_conf[:dbname] unless pm_conf[:dbname].to_s.empty?
+ args[:port] = pm_conf[:dbport] unless pm_conf[:dbport].to_s.empty?
socket = pm_conf[:dbsocket]
args[:socket] = socket unless socket.to_s.empty?
connections = pm_conf[:dbconnections].to_i
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index 79d74f01f..1f5e0eda4 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -680,6 +680,8 @@ module Puppet
:dbname => [ "puppet", "The name of the database to use." ],
:dbserver => [ "localhost", "The database server for caching. Only
used when networked databases are used."],
+ :dbport => [ "", "The database password for caching. Only
+ used when networked databases are used."],
:dbuser => [ "puppet", "The database user for caching. Only
used when networked databases are used."],
:dbpassword => [ "puppet", "The database password for caching. Only
diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb
index 1e02408b8..c3bf383bb 100644
--- a/lib/puppet/rails.rb
+++ b/lib/puppet/rails.rb
@@ -51,6 +51,7 @@ module Puppet::Rails
args[:database] = Puppet[:dblocation]
when "mysql", "postgresql"
args[:host] = Puppet[:dbserver] unless Puppet[:dbserver].empty?
+ args[:port] = Puppet[:dbport] unless Puppet[:dbport].empty?
args[:username] = Puppet[:dbuser] unless Puppet[:dbuser].empty?
args[:password] = Puppet[:dbpassword] unless Puppet[:dbpassword].empty?
args[:database] = Puppet[:dbname]
diff --git a/spec/unit/rails.rb b/spec/unit/rails.rb
index 944bf4532..b16e6be4a 100755
--- a/spec/unit/rails.rb
+++ b/spec/unit/rails.rb
@@ -90,10 +90,11 @@ end
describe Puppet::Rails, "when initializing a mysql connection" do
confine "Cannot test without ActiveRecord" => Puppet.features.rails?
- it "should provide the adapter, log_level, and host, username, password, database, and reconnect arguments" do
+ it "should provide the adapter, log_level, and host, port, username, password, database, and reconnect 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(:dbport).returns("")
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
@@ -112,10 +113,11 @@ describe Puppet::Rails, "when initializing a mysql connection" do
}
end
- it "should provide the adapter, log_level, and host, username, password, database, socket, connections, and reconnect arguments" do
+ it "should provide the adapter, log_level, and host, port, username, password, database, socket, connections, and reconnect 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(:dbport).returns("9999")
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
@@ -126,6 +128,7 @@ describe Puppet::Rails, "when initializing a mysql connection" do
:adapter => "mysql",
:log_level => "testlevel",
:host => "testserver",
+ :port => "9999",
:username => "testuser",
:password => "testpassword",
:database => "testname",
@@ -135,10 +138,11 @@ describe Puppet::Rails, "when initializing a mysql connection" do
}
end
- it "should provide the adapter, log_level, and host, username, password, database, socket, and connections arguments" do
+ it "should provide the adapter, log_level, and host, port, 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(:dbport).returns("9999")
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
@@ -149,6 +153,7 @@ describe Puppet::Rails, "when initializing a mysql connection" do
:adapter => "mysql",
:log_level => "testlevel",
:host => "testserver",
+ :port => "9999",
:username => "testuser",
:password => "testpassword",
:database => "testname",
@@ -162,10 +167,11 @@ end
describe Puppet::Rails, "when initializing a postgresql connection" do
confine "Cannot test without ActiveRecord" => Puppet.features.rails?
- it "should provide the adapter, log_level, and host, username, password, connections, and database arguments" do
+ it "should provide the adapter, log_level, and host, port, username, password, connections, and database arguments" do
Puppet.settings.stubs(:value).with(:dbadapter).returns("postgresql")
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
+ Puppet.settings.stubs(:value).with(:dbport).returns("9999")
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
@@ -176,6 +182,7 @@ describe Puppet::Rails, "when initializing a postgresql connection" do
:adapter => "postgresql",
:log_level => "testlevel",
:host => "testserver",
+ :port => "9999",
:username => "testuser",
:password => "testpassword",
:database => "testname",
@@ -184,10 +191,11 @@ describe Puppet::Rails, "when initializing a postgresql connection" do
}
end
- it "should provide the adapter, log_level, and host, username, password, database, connections, and socket arguments" do
+ it "should provide the adapter, log_level, and host, port, username, password, database, connections, and socket arguments" do
Puppet.settings.stubs(:value).with(:dbadapter).returns("postgresql")
Puppet.settings.stubs(:value).with(:rails_loglevel).returns("testlevel")
Puppet.settings.stubs(:value).with(:dbserver).returns("testserver")
+ Puppet.settings.stubs(:value).with(:dbport).returns("9999")
Puppet.settings.stubs(:value).with(:dbuser).returns("testuser")
Puppet.settings.stubs(:value).with(:dbpassword).returns("testpassword")
Puppet.settings.stubs(:value).with(:dbname).returns("testname")
@@ -198,6 +206,7 @@ describe Puppet::Rails, "when initializing a postgresql connection" do
:adapter => "postgresql",
:log_level => "testlevel",
:host => "testserver",
+ :port => "9999",
:username => "testuser",
:password => "testpassword",
:database => "testname",