Merge pull request #130 from stefanandres/jetty_max_threads

implement max_threads option for jetty
This commit is contained in:
Ken Barber 2014-07-01 11:49:06 +01:00
commit c706255bc0
6 changed files with 42 additions and 2 deletions

View file

@ -293,6 +293,11 @@ Java VM options used for overriding default Java VM options specified in PuppetD
Example: to set `-Xmx512m -Xms256m` options use `{ '-Xmx' => '512m', '-Xms' => '256m' }`
####`max_threads`
Jetty option to explicetly set max-thread. The default is undef, so the PuppetDB-jetty default is used.
### puppetdb:server
The `puppetdb::server` class manages the puppetdb server independently of the underlying database that it depends on. It will manage the puppetdb package, service, config files, etc., but will still allow you to manage the database (e.g. postgresql) however you see fit.

View file

@ -29,7 +29,8 @@ class puppetdb(
$puppetdb_service_status = $puppetdb::params::puppetdb_service_status,
$open_postgres_port = $puppetdb::params::open_postgres_port,
$confdir = $puppetdb::params::confdir,
$java_args = {}
$java_args = {},
$max_threads = $puppetdb::params::max_threads
) inherits puppetdb::params {
# Apply necessary suffix if zero is specified.
@ -95,6 +96,7 @@ class puppetdb(
puppetdb_service_status => $puppetdb_service_status,
confdir => $confdir,
java_args => $java_args,
max_threads => $max_threads,
}
if ($database == 'postgres') {

View file

@ -34,6 +34,8 @@ class puppetdb::params {
$conn_keep_alive = '45'
$conn_lifetime = '0'
$max_threads = undef
case $::osfamily {
'RedHat': {
$firewall_supported = true

View file

@ -28,7 +28,8 @@ class puppetdb::server(
$puppetdb_service_status = $puppetdb::params::puppetdb_service_status,
$confdir = $puppetdb::params::confdir,
$manage_firewall = true,
$java_args = {}
$java_args = {},
$max_threads = $puppetdb::params::max_threads
) inherits puppetdb::params {
# Apply necessary suffix if zero is specified.
@ -108,6 +109,7 @@ class puppetdb::server(
ssl_listen_port => $ssl_listen_port,
disable_ssl => $disable_ssl,
confdir => $confdir,
max_threads => $max_threads,
notify => Service[$puppetdb_service],
}

View file

@ -6,6 +6,7 @@ class puppetdb::server::jetty_ini(
$ssl_listen_port = $puppetdb::params::ssl_listen_port,
$disable_ssl = $puppetdb::params::disable_ssl,
$confdir = $puppetdb::params::confdir,
$max_threads = $puppetdb::params::max_threads,
) inherits puppetdb::params {
#Set the defaults
@ -44,4 +45,16 @@ class puppetdb::server::jetty_ini(
setting => 'ssl-port',
value => $ssl_listen_port,
}
if ($max_threads) {
ini_setting {'puppetdb_max_threads':
setting => 'max-threads',
value => $max_threads,
}
} else {
ini_setting {'puppetdb_max_threads':
ensure => absent,
setting => 'max-threads',
}
}
}

View file

@ -83,5 +83,21 @@ describe 'puppetdb::server::jetty_ini', :type => :class do
'setting' => 'ssl-port'
)}
end
describe 'when setting max_threads' do
let(:params) do
{
'max_threads' => 150
}
end
it { should contain_ini_setting('puppetdb_max_threads').
with(
'ensure' => 'present',
'path' => '/etc/puppetdb/conf.d/jetty.ini',
'section' => 'jetty',
'setting' => 'max-threads',
'value' => '150'
)}
end
end
end