(maint) Add ability to manage old terminus style

This commit adds the ability to manage to legacy style of terminus for
`PuppetDB 2.x`.
This commit is contained in:
Andrew Roetker 2015-06-16 10:44:15 -07:00
parent 6cb77ff799
commit 8e4c803f58
4 changed files with 48 additions and 3 deletions

View file

@ -145,6 +145,8 @@ 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.
See the CHANGELOG file for more detailed information on changes for each release.

View file

@ -126,6 +126,7 @@ 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',
require => $strict_validation ? {
true => Puppetdb_conn_validator['puppetdb_conn'],
default => Package[$terminus_package_name],

View file

@ -8,6 +8,7 @@ class puppetdb::master::puppetdb_conf (
default => false,
},
$puppet_confdir = $puppetdb::params::puppet_confdir,
$legacy_terminus = false,
) inherits puppetdb::params {
Ini_setting {
@ -16,9 +17,20 @@ class puppetdb::master::puppetdb_conf (
path => "${puppet_confdir}/puppetdb.conf",
}
ini_setting { 'puppetdbserver_urls':
setting => 'server_urls',
value => "https://#{server}:#{port}/",
if $legacy_terminus {
ini_setting { 'puppetdbserver':
setting => 'server',
value => $server,
}
ini_setting { 'puppetdbport':
setting => 'port',
value => $port,
}
} else {
ini_setting { 'puppetdbserver_urls':
setting => 'server_urls',
value => "https://${server}:${port}/",
}
}
ini_setting { 'soft_write_failure':

View file

@ -0,0 +1,30 @@
require 'spec_helper'
describe 'puppetdb::master::puppetdb_conf', :type => :class do
let(:facts) do
{
:fqdn => 'puppetdb.example.com',
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '6.0',
:kernel => 'Linux',
:concat_basedir => '/var/lib/puppet/concat',
:id => 'root',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
let(:pre_condition) { 'class { "puppetdb": }' }
context 'when using using default values' do
it { should contain_ini_setting('puppetdbserver_urls').with( :value => 'https://localhost:8081/' )}
end
context 'when using using default values' do
let (:params) do { :legacy_terminus => true, } end
it { should contain_ini_setting('puppetdbserver').with( :value => 'localhost' )}
it { should contain_ini_setting('puppetdbport').with( :value => '8081' )}
end
end