(maint) Add pathing for AIO, defaulting to non-AIO for older PDBs
This commit adds a globals class to PuppetDB which allows us to change the param defaults for the module depending on what version of PuppetDB they are using (similar to the PostgreSQL module). This commit also changes the default PuppetDB 3.x configuration pathing to assume AIO Puppet.
This commit is contained in:
parent
c182b4cec6
commit
b95fc919b7
11 changed files with 295 additions and 129 deletions
42
README.md
42
README.md
|
@ -144,23 +144,26 @@ Upgrading
|
|||
Significant parameter changes are listed below:
|
||||
|
||||
* The PuppetDB module now supports PuppetDB 3.0.0 by default
|
||||
* If you want to use 5.x of the module with PuppetDB 2.x, you'll need to set `puppetdb_version => 2.y.z` or `terminus_package => 2.y.z`
|
||||
* The `puppetdb::master:puppetdb_conf` class has added a `$legacy_terminus` parameter which will be set the correct default if you set `puppetdb_version => 2.y.z` or `terminus_package => 2.y.z`.
|
||||
* The default `test_url` for the `PuppetDBConnValidator` has also been chaged to `/pdb/meta/v1/version` but will also be set the correct default if you set `puppetdb_version => 2.y.z` or `terminus_package => 2.y.z`.
|
||||
* If you want to use 5.x of the module with PuppetDB 2.x, you'll need to use the new `puppetdb::globals` class to set the version of PuppetDB you're using explicitly. The ability to configure the version has been therefore moved out of the `puppetdb` and `puppetdb::server` classes.
|
||||
For example if your config looked like this before:
|
||||
~~~ruby
|
||||
class { 'puppetdb::master::config':
|
||||
puppetdb_server => 'foo.example.com',
|
||||
puppetdb_version => present,
|
||||
class {'puppetdb':
|
||||
puppetdb_version => '2.3.5-1.e7',
|
||||
}
|
||||
class { 'puppetdb::master::config': }
|
||||
~~~
|
||||
and you'd still like to use the module with PuppetDB 2.3.5, all you'd have to change would be:
|
||||
~~~ruby
|
||||
class { 'puppetdb::master::config':
|
||||
puppetdb_server => 'foo.example.com',
|
||||
terminus_package => '2.3.5',
|
||||
class { 'puppetdb::globals':
|
||||
version => '2.3.5-1.e7',
|
||||
}
|
||||
class { 'puppetdb' : }
|
||||
class { 'puppetdb::master::config' : }
|
||||
~~~
|
||||
The `globals` class above takes into account the following PuppetDB 3 and Puppet 4 related changes:
|
||||
* The `puppetdb::master:puppetdb_conf` class has added a `$legacy_terminus` to support the PuppetDB 2.x terminus configuration.
|
||||
* The default `test_url` for the `PuppetDBConnValidator` has also been chaged to `/pdb/meta/v1/version` but will default to `/v3/version` when using a PuppetDB 2.x version.
|
||||
* The configuration pathing for Puppet and PuppetDB has changed with Puppet 4 and PuppetDB 3, using PuppetDB 2.x or older assumes the old configuration pathing.
|
||||
|
||||
See the CHANGELOG file for more detailed information on changes for each release.
|
||||
|
||||
|
@ -204,6 +207,19 @@ Usage
|
|||
|
||||
PuppetDB supports a large number of configuration options for both configuring the puppetdb service and connecting that service to the puppet master.
|
||||
|
||||
### puppetdb::globals
|
||||
The `puppetdb::globals` class is intended to provide similar functionality to the `postgresql::globals` class in the `puppetlabs-postgresql` module by exposing a top-level entry-point into the module so that we can properly set defaults for the `puppetdb::params` class based on the version of `puppetdb` you are using. This setting defaults to `present`.
|
||||
|
||||
You must declare the class to use it:
|
||||
|
||||
class { 'puppetdb::globals': }
|
||||
|
||||
**Parameters within `puppetdb::globals`:**
|
||||
|
||||
####`version`
|
||||
|
||||
The version of the `puppetdb` package that should be installed. You may specify an explicit version number, 'present', or 'latest' (defaults to 'present').
|
||||
|
||||
### puppetdb
|
||||
The `puppetdb` class is intended as a high-level abstraction (sort of an 'all-in-one' class) to help simplify the process of getting your puppetdb server up and running. It wraps the slightly-lower-level classes `puppetdb::server` and `puppetdb::database::*`, and it'll get you up and running with everything you need (including database setup and management) on the server side. For maximum configurability, you may choose not to use this class. You may prefer to use the `puppetdb::server` class directly, or manage your puppetdb setup on your own.
|
||||
|
||||
|
@ -330,10 +346,6 @@ If not supplied, we won't terminate connections based on their age alone. This o
|
|||
|
||||
The puppetdb package name in the package manager.
|
||||
|
||||
####`puppetdb_version`
|
||||
|
||||
The version of the `puppetdb` package that should be installed. You may specify an explicit version number, 'present', or 'latest' (defaults to 'present').
|
||||
|
||||
####`puppetdb_service`
|
||||
|
||||
The name of the puppetdb service.
|
||||
|
@ -537,10 +549,6 @@ Puppet's config file (defaults to `/etc/puppet/puppet.conf`).
|
|||
|
||||
A boolean switch to enable or disable the masterless setup of PuppetDB.
|
||||
|
||||
####`puppetdb_version`
|
||||
|
||||
The version of the `puppetdb` package that should be installed. You may specify an explicit version number, 'present', or 'latest' (defaults to 'present').
|
||||
|
||||
####`terminus_package`
|
||||
|
||||
Name of the package to use that represents the PuppetDB terminus code.
|
||||
|
|
10
manifests/globals.pp
Normal file
10
manifests/globals.pp
Normal file
|
@ -0,0 +1,10 @@
|
|||
class puppetdb::globals (
|
||||
$version = 'present',
|
||||
$database = 'postgres',
|
||||
) {
|
||||
|
||||
if !($::osfamily in ['RedHat', 'Suse', 'Archlinux', 'Debian', 'OpenBSD', 'FreeBSD']) {
|
||||
fail("${module_name} does not support your osfamily ${::osfamily}")
|
||||
}
|
||||
|
||||
}
|
|
@ -40,7 +40,6 @@ class puppetdb (
|
|||
$conn_keep_alive = $puppetdb::params::conn_keep_alive,
|
||||
$conn_lifetime = $puppetdb::params::conn_lifetime,
|
||||
$puppetdb_package = $puppetdb::params::puppetdb_package,
|
||||
$puppetdb_version = $puppetdb::params::puppetdb_version,
|
||||
$puppetdb_service = $puppetdb::params::puppetdb_service,
|
||||
$puppetdb_service_status = $puppetdb::params::puppetdb_service_status,
|
||||
$puppetdb_user = $puppetdb::params::puppetdb_user,
|
||||
|
@ -102,7 +101,6 @@ class puppetdb (
|
|||
conn_keep_alive => $conn_keep_alive,
|
||||
conn_lifetime => $conn_lifetime,
|
||||
puppetdb_package => $puppetdb_package,
|
||||
puppetdb_version => $puppetdb_version,
|
||||
puppetdb_service => $puppetdb_service,
|
||||
puppetdb_service_status => $puppetdb_service_status,
|
||||
confdir => $confdir,
|
||||
|
|
|
@ -22,39 +22,16 @@ class puppetdb::master::config (
|
|||
$enable_reports = false,
|
||||
$puppet_confdir = $puppetdb::params::puppet_confdir,
|
||||
$puppet_conf = $puppetdb::params::puppet_conf,
|
||||
$puppetdb_version = $puppetdb::params::puppetdb_version,
|
||||
$terminus_package = '',
|
||||
$terminus_package = $puppetdb::params::terminus_package,
|
||||
$puppet_service_name = $puppetdb::params::puppet_service_name,
|
||||
$puppetdb_startup_timeout = $puppetdb::params::puppetdb_startup_timeout,
|
||||
$test_url = '',
|
||||
$test_url = $puppetdb::params::test_url,
|
||||
$restart_puppet = true,
|
||||
) inherits puppetdb::params {
|
||||
|
||||
if empty($terminus_package) {
|
||||
$old_terminus_name = versioncmp($puppetdb_version, '3.0.0') < 0
|
||||
$terminus_package_name = $puppetdb_version ? {
|
||||
/(latest|present|absent)/ => 'puppetdb-termini',
|
||||
default => $old_terminus_name ? {
|
||||
true => 'puppetdb-terminus',
|
||||
false => 'puppetdb-termini'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$terminus_package_name = $terminus_package
|
||||
}
|
||||
|
||||
package { $terminus_package_name:
|
||||
ensure => $puppetdb_version,
|
||||
}
|
||||
|
||||
if empty($test_url) {
|
||||
if $terminus_package_name == 'puppetdb-terminus' {
|
||||
$terminus_test_url = '/v3/version'
|
||||
} else {
|
||||
$terminus_test_url = '/pdb/meta/v1/version'
|
||||
}
|
||||
} else {
|
||||
$terminus_test_url = $test_url
|
||||
package { $terminus_package:
|
||||
ensure => $puppetdb::params::puppetdb_version,
|
||||
}
|
||||
|
||||
if ($strict_validation) {
|
||||
|
@ -75,8 +52,8 @@ class puppetdb::master::config (
|
|||
default => true,
|
||||
},
|
||||
timeout => $puppetdb_startup_timeout,
|
||||
require => Package[$terminus_package_name],
|
||||
test_url => $terminus_test_url,
|
||||
require => Package[$terminus_package],
|
||||
test_url => $test_url,
|
||||
}
|
||||
|
||||
# This is a bit of puppet chicanery that allows us to create a
|
||||
|
@ -94,7 +71,7 @@ class puppetdb::master::config (
|
|||
masterless => $masterless,
|
||||
require => $strict_validation ? {
|
||||
true => Puppetdb_conn_validator['puppetdb_conn'],
|
||||
default => Package[$terminus_package_name],
|
||||
default => Package[$terminus_package],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +85,7 @@ class puppetdb::master::config (
|
|||
masterless => $masterless,
|
||||
require => $strict_validation ? {
|
||||
true => Puppetdb_conn_validator['puppetdb_conn'],
|
||||
default => Package[$terminus_package_name],
|
||||
default => Package[$terminus_package],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +100,7 @@ class puppetdb::master::config (
|
|||
enable => $enable_reports,
|
||||
require => $strict_validation ? {
|
||||
true => Puppetdb_conn_validator['puppetdb_conn'],
|
||||
default => Package[$terminus_package_name],
|
||||
default => Package[$terminus_package],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -136,10 +113,10 @@ class puppetdb::master::config (
|
|||
port => $puppetdb_port,
|
||||
soft_write_failure => $puppetdb_soft_write_failure,
|
||||
puppet_confdir => $puppet_confdir,
|
||||
legacy_terminus => $terminus_package_name == 'puppetdb-terminus',
|
||||
legacy_terminus => $puppetdb::params::terminus_package == 'puppetdb-terminus',
|
||||
require => $strict_validation ? {
|
||||
true => Puppetdb_conn_validator['puppetdb_conn'],
|
||||
default => Package[$terminus_package_name],
|
||||
default => Package[$terminus_package],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,11 @@ class puppetdb::master::puppetdb_conf (
|
|||
default => false,
|
||||
},
|
||||
$puppet_confdir = $puppetdb::params::puppet_confdir,
|
||||
$legacy_terminus = false,
|
||||
) inherits puppetdb::params {
|
||||
$legacy_terminus = $puppetdb::params::terminus_package ? {
|
||||
/(puppetdb-terminus)/ => true,
|
||||
default => false,
|
||||
},
|
||||
) inherits puppetdb::params {
|
||||
|
||||
Ini_setting {
|
||||
ensure => present,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# PRIVATE CLASS - do not use directly
|
||||
#
|
||||
# The puppetdb default configuration settings.
|
||||
class puppetdb::params {
|
||||
class puppetdb::params inherits puppetdb::globals {
|
||||
$listen_address = 'localhost'
|
||||
$listen_port = '8080'
|
||||
$open_listen_port = false
|
||||
|
@ -12,8 +12,11 @@ class puppetdb::params {
|
|||
$open_ssl_listen_port = undef
|
||||
$postgres_listen_addresses = 'localhost'
|
||||
|
||||
$database = 'postgres'
|
||||
$puppetdb_version = $puppetdb::globals::version
|
||||
$database = $puppetdb::globals::database
|
||||
$manage_dbserver = true
|
||||
$manage_pg_repo = false
|
||||
$postgres_version = '9.4'
|
||||
|
||||
# The remaining database settings are not used for an embedded database
|
||||
$database_host = 'localhost'
|
||||
|
@ -23,16 +26,12 @@ class puppetdb::params {
|
|||
$database_password = 'puppetdb'
|
||||
$database_ssl = false
|
||||
$database_validate = true
|
||||
$postgres_version = '9.4'
|
||||
$manage_pg_repo = false
|
||||
|
||||
# These settings manage the various auto-deactivation and auto-purge settings
|
||||
$node_ttl = '0s'
|
||||
$node_purge_ttl = '0s'
|
||||
$report_ttl = '14d'
|
||||
|
||||
$puppetdb_version = 'present'
|
||||
|
||||
$gc_interval = '60'
|
||||
|
||||
$log_slow_statements = '10'
|
||||
|
@ -65,57 +64,67 @@ class puppetdb::params {
|
|||
$puppetdb_group = 'puppetdb'
|
||||
$masterless = false
|
||||
|
||||
if !($puppetdb_version in ['latest','present','absent']) and versioncmp($puppetdb_version, '3.0.0') < 0 {
|
||||
case $::osfamily {
|
||||
'RedHat', 'Suse', 'Archlinux','Debian': {
|
||||
$confdir = '/etc/puppetdb/conf.d'
|
||||
$database_embedded_path = '/var/lib/puppetdb/db/db'
|
||||
$puppet_confdir = pick($settings::confdir,'/etc/puppet')
|
||||
$puppet_service_name = 'puppetmaster'
|
||||
$ssl_dir = '/etc/puppetdb/ssl'
|
||||
}
|
||||
'OpenBSD': {
|
||||
$confdir = '/etc/puppetdb/conf.d'
|
||||
$database_embedded_path = '/var/db/puppetdb/db/db'
|
||||
$puppet_confdir = pick($settings::confdir,'/etc/puppet')
|
||||
$puppet_service_name = 'puppetmasterd'
|
||||
$ssl_dir = '/etc/puppetdb/ssl'
|
||||
}
|
||||
'FreeBSD': {
|
||||
$confdir = '/usr/local/etc/puppetdb/conf.d'
|
||||
$database_embedded_path = '/var/db/puppetdb/db/db'
|
||||
$puppet_confdir = pick($settings::confdir,'/usr/local/etc/puppet')
|
||||
$puppet_service_name = 'puppetmaster'
|
||||
$ssl_dir = '/usr/local/etc/puppetdb/ssl'
|
||||
}
|
||||
}
|
||||
$terminus_package = 'puppetdb-terminus'
|
||||
$test_url = '/v3/version'
|
||||
} else {
|
||||
case $::osfamily {
|
||||
'RedHat', 'Suse', 'Archlinux','Debian': {
|
||||
$confdir = '/etc/puppetlabs/puppetdb/conf.d'
|
||||
$puppet_confdir = pick($settings::confdir,'/etc/puppetlabs/puppet')
|
||||
$puppet_service_name = 'puppetserver'
|
||||
$ssl_dir = '/etc/puppetlabs/puppetdb/ssl'
|
||||
}
|
||||
'OpenBSD': {
|
||||
$confdir = '/etc/puppetlabs/puppetdb/conf.d'
|
||||
$puppet_confdir = pick($settings::confdir,'/etc/puppetlabs/puppet')
|
||||
$puppet_service_name = undef
|
||||
$ssl_dir = '/etc/puppetlabs/puppetdb/ssl'
|
||||
}
|
||||
'FreeBSD': {
|
||||
$confdir = '/usr/local/etc/puppetlabs/puppetdb/conf.d'
|
||||
$puppet_confdir = pick($settings::confdir,'/usr/local/etc/puppetlabs/puppet')
|
||||
$puppet_service_name = undef
|
||||
$ssl_dir = '/usr/local/etc/puppetlabs/puppetdb/ssl'
|
||||
}
|
||||
}
|
||||
$terminus_package = 'puppetdb-termini'
|
||||
$test_url = '/pdb/meta/v1/version'
|
||||
$database_embedded_path = '/opt/puppetlabs/server/data/puppetdb/db/db'
|
||||
}
|
||||
|
||||
case $::osfamily {
|
||||
'RedHat', 'Suse', 'Archlinux': {
|
||||
$confdir = '/etc/puppetdb/conf.d'
|
||||
$database_embedded_path = '/var/lib/puppetdb/db/db'
|
||||
$puppetdb_initconf = '/etc/sysconfig/puppetdb'
|
||||
if $settings::confdir != undef {
|
||||
$puppet_confdir = $settings::confdir
|
||||
} else {
|
||||
$puppet_confdir = '/etc/puppet'
|
||||
}
|
||||
$puppet_service_name = 'puppetmaster'
|
||||
$ssl_dir = '/etc/puppetdb/ssl'
|
||||
}
|
||||
'Debian': {
|
||||
$confdir = '/etc/puppetdb/conf.d'
|
||||
$database_embedded_path = '/var/lib/puppetdb/db/db'
|
||||
$puppetdb_initconf = '/etc/default/puppetdb'
|
||||
if $settings::confdir != undef {
|
||||
$puppet_confdir = $settings::confdir
|
||||
} else {
|
||||
$puppet_confdir = '/etc/puppet'
|
||||
}
|
||||
$puppet_service_name = 'puppetmaster'
|
||||
$ssl_dir = '/etc/puppetdb/ssl'
|
||||
}
|
||||
'OpenBSD': {
|
||||
$confdir = '/etc/puppetdb/conf.d'
|
||||
$database_embedded_path = '/var/db/puppetdb/db/db'
|
||||
'OpenBSD','FreeBSD': {
|
||||
$puppetdb_initconf = undef
|
||||
if $settings::confdir != undef {
|
||||
$puppet_confdir = $settings::confdir
|
||||
} else {
|
||||
$puppet_confdir = '/etc/puppet'
|
||||
}
|
||||
$puppet_service_name = 'puppetmasterd'
|
||||
$ssl_dir = '/etc/puppetdb/ssl'
|
||||
}
|
||||
'FreeBSD': {
|
||||
$confdir = '/usr/local/etc/puppetdb/conf.d'
|
||||
$database_embedded_path = '/var/db/puppetdb/db/db'
|
||||
$puppetdb_initconf = undef
|
||||
if $settings::confdir != undef {
|
||||
$puppet_confdir = $settings::confdir
|
||||
} else {
|
||||
$puppet_confdir = '/usr/local/etc/puppet'
|
||||
}
|
||||
$puppet_service_name = 'puppetmaster'
|
||||
$ssl_dir = '/usr/local/etc/puppetdb/ssl'
|
||||
}
|
||||
default: {
|
||||
fail("${module_name} does not support your osfamily ${::osfamily}")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ class puppetdb::server (
|
|||
$conn_keep_alive = $puppetdb::params::conn_keep_alive,
|
||||
$conn_lifetime = $puppetdb::params::conn_lifetime,
|
||||
$puppetdb_package = $puppetdb::params::puppetdb_package,
|
||||
$puppetdb_version = $puppetdb::params::puppetdb_version,
|
||||
$puppetdb_service = $puppetdb::params::puppetdb_service,
|
||||
$puppetdb_service_status = $puppetdb::params::puppetdb_service_status,
|
||||
$puppetdb_user = $puppetdb::params::puppetdb_user,
|
||||
|
@ -92,8 +91,10 @@ class puppetdb::server (
|
|||
validate_re ($report_ttl_real, ['^\d+(d|h|m|s|ms)$'], "report_ttl is <${report_ttl}> which does not match the regex validation")
|
||||
|
||||
# Validate puppetdb_service_status
|
||||
if !($puppetdb_service_status in ['true', 'running', 'false', 'stopped']) {
|
||||
fail("puppetdb_service_status valid values are 'true', 'running', 'false', and 'stopped'. You provided '${puppetdb_service_status}'")
|
||||
$service_enabled = $puppetdb_service_status ? {
|
||||
/(running|true)/ => true,
|
||||
/(stopped|false)/ => false,
|
||||
default => fail("puppetdb_service_status valid values are 'true', 'running', 'false', and 'stopped'. You provided '${puppetdb_service_status}'"),
|
||||
}
|
||||
|
||||
# Validate database type (Currently only postgres and embedded are supported)
|
||||
|
@ -107,7 +108,7 @@ class puppetdb::server (
|
|||
}
|
||||
|
||||
package { $puppetdb_package:
|
||||
ensure => $puppetdb_version,
|
||||
ensure => $puppetdb::params::puppetdb_version,
|
||||
notify => Service[$puppetdb_service],
|
||||
}
|
||||
|
||||
|
@ -237,12 +238,6 @@ class puppetdb::server (
|
|||
)
|
||||
}
|
||||
|
||||
$service_enabled = $puppetdb_service_status ? {
|
||||
/(running|true)/ => true,
|
||||
/(stopped|false)/ => false,
|
||||
default => true,
|
||||
}
|
||||
|
||||
service { $puppetdb_service:
|
||||
ensure => $puppetdb_service_status,
|
||||
enable => $service_enabled,
|
||||
|
|
|
@ -62,16 +62,12 @@ describe 'puppetdb::master::config', :type => :class do
|
|||
end
|
||||
|
||||
context 'when using default values' do
|
||||
let (:pre_condition) { 'class { "puppetdb": }' }
|
||||
|
||||
it { should contain_package('puppetdb-termini').with( :ensure => 'present' )}
|
||||
it { should contain_puppetdb_conn_validator('puppetdb_conn').with(:test_url => '/pdb/meta/v1/version')}
|
||||
end
|
||||
|
||||
context 'when using an older puppetdb version' do
|
||||
let (:pre_condition) { 'class { "puppetdb": puppetdb_version => "2.2.0", }' }
|
||||
let (:params) do { :puppetdb_version => '2.2.0' } end
|
||||
|
||||
let (:pre_condition) { 'class { "puppetdb::globals": version => "2.2.0", }' }
|
||||
it { should contain_package('puppetdb-terminus').with( :ensure => '2.2.0' )}
|
||||
it { should contain_puppetdb_conn_validator('puppetdb_conn').with(:test_url => '/v3/version')}
|
||||
end
|
||||
|
|
|
@ -11,6 +11,31 @@ describe 'puppetdb::server::config_ini', :type => :class do
|
|||
it { should contain_class('puppetdb::server::config_ini') }
|
||||
|
||||
describe 'when using default values' do
|
||||
it { should contain_ini_setting('puppetdb_config_command_processing_threads').
|
||||
with(
|
||||
'ensure' => 'absent',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
|
||||
'section' => 'command-processing',
|
||||
'setting' => 'threads'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_config_command_processing_store_usage').
|
||||
with(
|
||||
'ensure' => 'absent',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
|
||||
'section' => 'command-processing',
|
||||
'setting' => 'store-usage'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_config_command_processing_temp_usage').
|
||||
with(
|
||||
'ensure' => 'absent',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
|
||||
'section' => 'command-processing',
|
||||
'setting' => 'temp-usage'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'when using legacy PuppetDB' do
|
||||
let (:pre_condition) { 'class { "puppetdb::globals": version => "2.2.0", }' }
|
||||
it { should contain_ini_setting('puppetdb_config_command_processing_threads').
|
||||
with(
|
||||
'ensure' => 'absent',
|
||||
|
@ -45,7 +70,7 @@ describe 'puppetdb::server::config_ini', :type => :class do
|
|||
it { should contain_ini_setting('puppetdb_config_command_processing_threads').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetdb/conf.d/config.ini',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
|
||||
'section' => 'command-processing',
|
||||
'setting' => 'threads',
|
||||
'value' => '10'
|
||||
|
@ -53,7 +78,7 @@ describe 'puppetdb::server::config_ini', :type => :class do
|
|||
it { should contain_ini_setting('puppetdb_config_command_processing_store_usage').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetdb/conf.d/config.ini',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
|
||||
'section' => 'command-processing',
|
||||
'setting' => 'store-usage',
|
||||
'value' => '4000'
|
||||
|
@ -61,7 +86,7 @@ describe 'puppetdb::server::config_ini', :type => :class do
|
|||
it { should contain_ini_setting('puppetdb_config_command_processing_temp_usage').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetdb/conf.d/config.ini',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
|
||||
'section' => 'command-processing',
|
||||
'setting' => 'temp-usage',
|
||||
'value' => '2000'
|
||||
|
|
|
@ -14,6 +14,114 @@ describe 'puppetdb::server::database_ini', :type => :class do
|
|||
it { should contain_class('puppetdb::server::database_ini') }
|
||||
|
||||
describe 'when using default values' do
|
||||
it { should contain_ini_setting('puppetdb_psdatabase_username').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
|
||||
'section' => 'database',
|
||||
'setting' => 'username',
|
||||
'value' => 'puppetdb'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_psdatabase_password').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
|
||||
'section' => 'database',
|
||||
'setting' => 'password',
|
||||
'value' => 'puppetdb'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_classname').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
|
||||
'section' => 'database',
|
||||
'setting' => 'classname',
|
||||
'value' => 'org.postgresql.Driver'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_subprotocol').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
|
||||
'section' => 'database',
|
||||
'setting' => 'subprotocol',
|
||||
'value' => 'postgresql'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_subname').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
|
||||
'section' => 'database',
|
||||
'setting' => 'subname',
|
||||
'value' => '//localhost:5432/puppetdb'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_gc_interval').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
|
||||
'section' => 'database',
|
||||
'setting' => 'gc-interval',
|
||||
'value' => '60'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_node_ttl').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
|
||||
'section' => 'database',
|
||||
'setting' => 'node-ttl',
|
||||
'value' => '0s'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_node_purge_ttl').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
|
||||
'section' => 'database',
|
||||
'setting' => 'node-purge-ttl',
|
||||
'value' => '0s'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_report_ttl').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
|
||||
'section' => 'database',
|
||||
'setting' => 'report-ttl',
|
||||
'value' => '14d'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_log_slow_statements').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
|
||||
'section' => 'database',
|
||||
'setting' => 'log-slow-statements',
|
||||
'value' => 10
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_conn_max_age').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
|
||||
'section' => 'database',
|
||||
'setting' => 'conn-max-age',
|
||||
'value' => '60'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_conn_keep_alive').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
|
||||
'section' => 'database',
|
||||
'setting' => 'conn-keep-alive',
|
||||
'value' => '45'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_conn_lifetime').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
|
||||
'section' => 'database',
|
||||
'setting' => 'conn-lifetime',
|
||||
'value' => '0'
|
||||
)}
|
||||
end
|
||||
|
||||
describe 'when using a legacy PuppetDB version' do
|
||||
let (:pre_condition) { 'class { "puppetdb::globals": version => "2.2.0", }' }
|
||||
it { should contain_ini_setting('puppetdb_psdatabase_username').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
|
@ -130,7 +238,7 @@ describe 'puppetdb::server::database_ini', :type => :class do
|
|||
it { should contain_ini_setting('puppetdb_subname').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetdb/conf.d/database.ini',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/database.ini',
|
||||
'section' => 'database',
|
||||
'setting' => 'subname',
|
||||
'value' => 'file:/tmp/foo;hsqldb.tx=mvcc;sql.syntax_pgs=true'
|
||||
|
|
|
@ -12,6 +12,43 @@ describe 'puppetdb::server::jetty_ini', :type => :class do
|
|||
it { should contain_class('puppetdb::server::jetty_ini') }
|
||||
|
||||
describe 'when using default values' do
|
||||
it { should contain_ini_setting('puppetdb_host').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/jetty.ini',
|
||||
'section' => 'jetty',
|
||||
'setting' => 'host',
|
||||
'value' => 'localhost'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_port').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/jetty.ini',
|
||||
'section' => 'jetty',
|
||||
'setting' => 'port',
|
||||
'value' => 8080
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_sslhost').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/jetty.ini',
|
||||
'section' => 'jetty',
|
||||
'setting' => 'ssl-host',
|
||||
'value' => '0.0.0.0'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_sslport').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/jetty.ini',
|
||||
'section' => 'jetty',
|
||||
'setting' => 'ssl-port',
|
||||
'value' => 8081
|
||||
)}
|
||||
it { should_not contain_ini_setting('puppetdb_sslprotocols') }
|
||||
end
|
||||
|
||||
describe 'when using a legacy PuppetDB version' do
|
||||
let (:pre_condition) { 'class { "puppetdb::globals": version => "2.2.0", }' }
|
||||
it { should contain_ini_setting('puppetdb_host').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
|
@ -56,7 +93,7 @@ describe 'puppetdb::server::jetty_ini', :type => :class do
|
|||
it { should contain_ini_setting('puppetdb_host').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetdb/conf.d/jetty.ini',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/jetty.ini',
|
||||
'section' => 'jetty',
|
||||
'setting' => 'host',
|
||||
'value' => 'localhost'
|
||||
|
@ -64,7 +101,7 @@ describe 'puppetdb::server::jetty_ini', :type => :class do
|
|||
it { should contain_ini_setting('puppetdb_port').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetdb/conf.d/jetty.ini',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/jetty.ini',
|
||||
'section' => 'jetty',
|
||||
'setting' => 'port',
|
||||
'value' => 8080
|
||||
|
@ -72,14 +109,14 @@ describe 'puppetdb::server::jetty_ini', :type => :class do
|
|||
it { should contain_ini_setting('puppetdb_sslhost').
|
||||
with(
|
||||
'ensure' => 'absent',
|
||||
'path' => '/etc/puppetdb/conf.d/jetty.ini',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/jetty.ini',
|
||||
'section' => 'jetty',
|
||||
'setting' => 'ssl-host'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_sslport').
|
||||
with(
|
||||
'ensure' => 'absent',
|
||||
'path' => '/etc/puppetdb/conf.d/jetty.ini',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/jetty.ini',
|
||||
'section' => 'jetty',
|
||||
'setting' => 'ssl-port'
|
||||
)}
|
||||
|
@ -94,7 +131,7 @@ describe 'puppetdb::server::jetty_ini', :type => :class do
|
|||
it { should contain_ini_setting('puppetdb_max_threads').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetdb/conf.d/jetty.ini',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/jetty.ini',
|
||||
'section' => 'jetty',
|
||||
'setting' => 'max-threads',
|
||||
'value' => '150'
|
||||
|
@ -108,7 +145,7 @@ describe 'puppetdb::server::jetty_ini', :type => :class do
|
|||
it {
|
||||
should contain_ini_setting('puppetdb_sslprotocols').with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetdb/conf.d/jetty.ini',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/jetty.ini',
|
||||
'section' => 'jetty',
|
||||
'setting' => 'ssl-protocols',
|
||||
'value' => 'TLSv1, TLSv1.1, TLSv1.2'
|
||||
|
|
Loading…
Reference in a new issue