(maint) Use smarter defaults when managing test_url
This commit updates the handling of the `test_url` parameter to be smarter, using the PuppetDB `2.x` default for PuppetDB `2.x` and using the `3.x` default for PuppetDB `3.x`.
This commit is contained in:
parent
8e4c803f58
commit
2a70b8d33b
5 changed files with 32 additions and 7 deletions
20
README.md
20
README.md
|
@ -144,9 +144,23 @@ 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 the `test_url => /v3/version` and either `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` like above but if you use the class directly *and* you're using PuppetDB 2.x, you will need to change `$legacy_terminus` to true.
|
||||
|
||||
* 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`.
|
||||
For example if your config looked like this before:
|
||||
~~~ruby
|
||||
class { 'puppetdb::master::config':
|
||||
puppetdb_server => 'foo.example.com',
|
||||
puppetdb_version => present,
|
||||
}
|
||||
~~~
|
||||
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',
|
||||
}
|
||||
~~~
|
||||
|
||||
See the CHANGELOG file for more detailed information on changes for each release.
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class puppetdb::master::config (
|
|||
$terminus_package = '',
|
||||
$puppet_service_name = $puppetdb::params::puppet_service_name,
|
||||
$puppetdb_startup_timeout = $puppetdb::params::puppetdb_startup_timeout,
|
||||
$test_url = $puppetdb::params::test_url,
|
||||
$test_url = '',
|
||||
$restart_puppet = true,
|
||||
) inherits puppetdb::params {
|
||||
|
||||
|
@ -47,6 +47,16 @@ class puppetdb::master::config (
|
|||
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
|
||||
}
|
||||
|
||||
if ($strict_validation) {
|
||||
|
||||
# Validate the puppetdb connection. If we can't connect to puppetdb then we
|
||||
|
@ -66,7 +76,7 @@ class puppetdb::master::config (
|
|||
},
|
||||
timeout => $puppetdb_startup_timeout,
|
||||
require => Package[$terminus_package_name],
|
||||
test_url => $test_url,
|
||||
test_url => $terminus_test_url,
|
||||
}
|
||||
|
||||
# This is a bit of puppet chicanery that allows us to create a
|
||||
|
|
|
@ -58,7 +58,6 @@ class puppetdb::params {
|
|||
|
||||
$manage_firewall = true
|
||||
$java_args = {}
|
||||
$test_url = '/pdb/meta/v1/version'
|
||||
|
||||
$puppetdb_package = 'puppetdb'
|
||||
$puppetdb_service = 'puppetdb'
|
||||
|
|
|
@ -96,7 +96,7 @@ class puppetdb::server (
|
|||
fail("puppetdb_service_status valid values are 'true', 'running', 'false', and 'stopped'. You provided '${puppetdb_service_status}'")
|
||||
}
|
||||
|
||||
# Validate read-database type (Currently only postgres is supported)
|
||||
# Validate database type (Currently only postgres and embedded are supported)
|
||||
if !($database in ['postgres', 'embedded']) {
|
||||
fail("database must must be 'postgres' or 'embedded'. You provided '${database}'")
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ describe 'puppetdb::master::config', :type => :class 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
|
||||
|
@ -72,6 +73,7 @@ describe 'puppetdb::master::config', :type => :class do
|
|||
let (:params) do { :puppetdb_version => '2.2.0' } end
|
||||
|
||||
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
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue