(PDB-1913) manage vardir
This updates the module to manage vardir, and also makes room for general management of the global ini section.
This commit is contained in:
parent
db91599013
commit
2990f80ef1
12 changed files with 108 additions and 44 deletions
|
@ -70,21 +70,24 @@ class puppetdb::params inherits puppetdb::globals {
|
|||
case $::osfamily {
|
||||
'RedHat', 'Suse', 'Archlinux','Debian': {
|
||||
$confdir = '/etc/puppetdb/conf.d'
|
||||
$database_embedded_path = '/var/lib/puppetdb/db/db'
|
||||
$vardir = '/var/lib/puppetdb'
|
||||
$database_embedded_path = '${vardir}/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'
|
||||
$vardir = '/var/db/puppetdb'
|
||||
$database_embedded_path = '${vardir}/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'
|
||||
$vardir = '/var/db/puppetdb'
|
||||
$database_embedded_path = '${vardir}/db/db'
|
||||
$puppet_confdir = pick($settings::confdir,'/usr/local/etc/puppet')
|
||||
$puppet_service_name = 'puppetmaster'
|
||||
$ssl_dir = '/usr/local/etc/puppetdb/ssl'
|
||||
|
@ -115,7 +118,8 @@ class puppetdb::params inherits puppetdb::globals {
|
|||
}
|
||||
$terminus_package = 'puppetdb-termini'
|
||||
$test_url = '/pdb/meta/v1/version'
|
||||
$database_embedded_path = '/opt/puppetlabs/server/data/puppetdb/db/db'
|
||||
$vardir = '/opt/puppetlabs/server/data/puppetdb'
|
||||
$database_embedded_path = '${vardir}/db/db'
|
||||
}
|
||||
|
||||
case $::osfamily {
|
||||
|
|
|
@ -131,7 +131,7 @@ class puppetdb::server (
|
|||
}
|
||||
}
|
||||
|
||||
class { 'puppetdb::server::config_ini':
|
||||
class { 'puppetdb::server::command_processing':
|
||||
command_threads => $command_threads,
|
||||
store_usage => $store_usage,
|
||||
temp_usage => $temp_usage,
|
||||
|
@ -139,7 +139,7 @@ class puppetdb::server (
|
|||
notify => Service[$puppetdb_service],
|
||||
}
|
||||
|
||||
class { 'puppetdb::server::database_ini':
|
||||
class { 'puppetdb::server::database':
|
||||
database => $database,
|
||||
database_host => $database_host,
|
||||
database_port => $database_port,
|
||||
|
@ -162,7 +162,7 @@ class puppetdb::server (
|
|||
notify => Service[$puppetdb_service],
|
||||
}
|
||||
|
||||
class { 'puppetdb::server::read_database_ini':
|
||||
class { 'puppetdb::server::read_database':
|
||||
database => $read_database,
|
||||
database_host => $read_database_host,
|
||||
database_port => $read_database_port,
|
||||
|
@ -218,7 +218,7 @@ class puppetdb::server (
|
|||
}
|
||||
}
|
||||
|
||||
class { 'puppetdb::server::jetty_ini':
|
||||
class { 'puppetdb::server::jetty':
|
||||
listen_address => $listen_address,
|
||||
listen_port => $listen_port,
|
||||
ssl_listen_address => $ssl_listen_address,
|
||||
|
@ -258,17 +258,17 @@ class puppetdb::server (
|
|||
if $manage_firewall {
|
||||
Package[$puppetdb_package] ->
|
||||
Class['puppetdb::server::firewall'] ->
|
||||
Class['puppetdb::server::config_ini'] ->
|
||||
Class['puppetdb::server::database_ini'] ->
|
||||
Class['puppetdb::server::read_database_ini'] ->
|
||||
Class['puppetdb::server::jetty_ini'] ->
|
||||
Class['puppetdb::server::command_processing'] ->
|
||||
Class['puppetdb::server::database'] ->
|
||||
Class['puppetdb::server::read_database'] ->
|
||||
Class['puppetdb::server::jetty'] ->
|
||||
Service[$puppetdb_service]
|
||||
} else {
|
||||
Package[$puppetdb_package] ->
|
||||
Class['puppetdb::server::config_ini'] ->
|
||||
Class['puppetdb::server::database_ini'] ->
|
||||
Class['puppetdb::server::read_database_ini'] ->
|
||||
Class['puppetdb::server::jetty_ini'] ->
|
||||
Class['puppetdb::server::command_processing'] ->
|
||||
Class['puppetdb::server::database'] ->
|
||||
Class['puppetdb::server::read_database'] ->
|
||||
Class['puppetdb::server::jetty'] ->
|
||||
Service[$puppetdb_service]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# PRIVATE CLASS - do not use directly
|
||||
class puppetdb::server::config_ini (
|
||||
class puppetdb::server::command_processing (
|
||||
$command_threads = $puppetdb::params::command_threads,
|
||||
$store_usage = $puppetdb::params::store_usage,
|
||||
$temp_usage = $puppetdb::params::temp_usage,
|
||||
|
@ -21,36 +21,36 @@ class puppetdb::server::config_ini (
|
|||
}
|
||||
|
||||
if $command_threads {
|
||||
ini_setting { 'puppetdb_config_command_processing_threads':
|
||||
ini_setting { 'puppetdb_command_processing_threads':
|
||||
setting => 'threads',
|
||||
value => $command_threads,
|
||||
}
|
||||
} else {
|
||||
ini_setting { 'puppetdb_config_command_processing_threads':
|
||||
ini_setting { 'puppetdb_command_processing_threads':
|
||||
ensure => 'absent',
|
||||
setting => 'threads',
|
||||
}
|
||||
}
|
||||
|
||||
if $store_usage {
|
||||
ini_setting { 'puppetdb_config_command_processing_store_usage':
|
||||
ini_setting { 'puppetdb_command_processing_store_usage':
|
||||
setting => 'store-usage',
|
||||
value => $store_usage,
|
||||
}
|
||||
} else {
|
||||
ini_setting { 'puppetdb_config_command_processing_store_usage':
|
||||
ini_setting { 'puppetdb_command_processing_store_usage':
|
||||
ensure => 'absent',
|
||||
setting => 'store-usage',
|
||||
}
|
||||
}
|
||||
|
||||
if $temp_usage {
|
||||
ini_setting { 'puppetdb_config_command_processing_temp_usage':
|
||||
ini_setting { 'puppetdb_command_processing_temp_usage':
|
||||
setting => 'temp-usage',
|
||||
value => $temp_usage,
|
||||
}
|
||||
} else {
|
||||
ini_setting { 'puppetdb_config_command_processing_temp_usage':
|
||||
ini_setting { 'puppetdb_command_processing_temp_usage':
|
||||
ensure => 'absent',
|
||||
setting => 'temp-usage',
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
# PRIVATE CLASS - do not use directly
|
||||
class puppetdb::server::database_ini (
|
||||
class puppetdb::server::database (
|
||||
$database = $puppetdb::params::database,
|
||||
$database_host = $puppetdb::params::database_host,
|
||||
$database_port = $puppetdb::params::database_port,
|
20
manifests/server/global.pp
Normal file
20
manifests/server/global.pp
Normal file
|
@ -0,0 +1,20 @@
|
|||
# PRIVATE CLASS - do not use directly
|
||||
class puppetdb::server::global (
|
||||
$vardir = $puppetdb::params::vardir,
|
||||
) inherits puppetdb::params {
|
||||
|
||||
# Set the defaults
|
||||
Ini_setting {
|
||||
path => "${confdir}/config.ini",
|
||||
ensure => 'present',
|
||||
section => 'global',
|
||||
require => File["${confdir}/config.ini"],
|
||||
}
|
||||
|
||||
if $vardir {
|
||||
ini_setting { 'puppetdb_global_vardir':
|
||||
setting => 'vardir',
|
||||
value => $vardir,
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
# PRIVATE CLASS - do not use directly
|
||||
class puppetdb::server::jetty_ini (
|
||||
class puppetdb::server::jetty (
|
||||
$listen_address = $puppetdb::params::listen_address,
|
||||
$listen_port = $puppetdb::params::listen_port,
|
||||
$ssl_listen_address = $puppetdb::params::ssl_listen_address,
|
|
@ -1,5 +1,5 @@
|
|||
# PRIVATE CLASS - do not use directly
|
||||
class puppetdb::server::read_database_ini (
|
||||
class puppetdb::server::read_database (
|
||||
$database = $puppetdb::params::read_database,
|
||||
$database_host = $puppetdb::params::read_database_host,
|
||||
$database_port = $puppetdb::params::read_database_port,
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'puppetdb::server::config_ini', :type => :class do
|
||||
describe 'puppetdb::server::command_processing', :type => :class do
|
||||
context 'on a supported platform' do
|
||||
let(:facts) do
|
||||
{
|
||||
|
@ -8,24 +8,24 @@ describe 'puppetdb::server::config_ini', :type => :class do
|
|||
}
|
||||
end
|
||||
|
||||
it { should contain_class('puppetdb::server::config_ini') }
|
||||
it { should contain_class('puppetdb::server::command_processing') }
|
||||
|
||||
describe 'when using default values' do
|
||||
it { should contain_ini_setting('puppetdb_config_command_processing_threads').
|
||||
it { should contain_ini_setting('puppetdb_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').
|
||||
it { should contain_ini_setting('puppetdb_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').
|
||||
it { should contain_ini_setting('puppetdb_command_processing_temp_usage').
|
||||
with(
|
||||
'ensure' => 'absent',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
|
||||
|
@ -36,21 +36,21 @@ describe 'puppetdb::server::config_ini', :type => :class do
|
|||
|
||||
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').
|
||||
it { should contain_ini_setting('puppetdb_command_processing_threads').
|
||||
with(
|
||||
'ensure' => 'absent',
|
||||
'path' => '/etc/puppetdb/conf.d/config.ini',
|
||||
'section' => 'command-processing',
|
||||
'setting' => 'threads'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_config_command_processing_store_usage').
|
||||
it { should contain_ini_setting('puppetdb_command_processing_store_usage').
|
||||
with(
|
||||
'ensure' => 'absent',
|
||||
'path' => '/etc/puppetdb/conf.d/config.ini',
|
||||
'section' => 'command-processing',
|
||||
'setting' => 'store-usage'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_config_command_processing_temp_usage').
|
||||
it { should contain_ini_setting('puppetdb_command_processing_temp_usage').
|
||||
with(
|
||||
'ensure' => 'absent',
|
||||
'path' => '/etc/puppetdb/conf.d/config.ini',
|
||||
|
@ -67,7 +67,7 @@ describe 'puppetdb::server::config_ini', :type => :class do
|
|||
'temp_usage' => 2000,
|
||||
}
|
||||
end
|
||||
it { should contain_ini_setting('puppetdb_config_command_processing_threads').
|
||||
it { should contain_ini_setting('puppetdb_command_processing_threads').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
|
||||
|
@ -75,7 +75,7 @@ describe 'puppetdb::server::config_ini', :type => :class do
|
|||
'setting' => 'threads',
|
||||
'value' => '10'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_config_command_processing_store_usage').
|
||||
it { should contain_ini_setting('puppetdb_command_processing_store_usage').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
|
||||
|
@ -83,7 +83,7 @@ describe 'puppetdb::server::config_ini', :type => :class do
|
|||
'setting' => 'store-usage',
|
||||
'value' => '4000'
|
||||
)}
|
||||
it { should contain_ini_setting('puppetdb_config_command_processing_temp_usage').
|
||||
it { should contain_ini_setting('puppetdb_command_processing_temp_usage').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'puppetdb::server::database_ini', :type => :class do
|
||||
describe 'puppetdb::server::database', :type => :class do
|
||||
context 'on a supported platform' do
|
||||
let(:facts) do
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ describe 'puppetdb::server::database_ini', :type => :class do
|
|||
}
|
||||
end
|
||||
|
||||
it { should contain_class('puppetdb::server::database_ini') }
|
||||
it { should contain_class('puppetdb::server::database') }
|
||||
|
||||
describe 'when using default values' do
|
||||
it { should contain_ini_setting('puppetdb_psdatabase_username').
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'puppetdb::server::database_ini', :type => :class do
|
||||
describe 'puppetdb::server::database', :type => :class do
|
||||
context 'on a supported platform' do
|
||||
let(:facts) do
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ describe 'puppetdb::server::database_ini', :type => :class do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'puppetdb::server::read_database_ini', :type => :class do
|
||||
describe 'puppetdb::server::read_database', :type => :class do
|
||||
context 'on a supported platform' do
|
||||
let(:facts) do
|
||||
{
|
||||
|
|
40
spec/unit/classes/server/global_ini_spec.rb
Normal file
40
spec/unit/classes/server/global_ini_spec.rb
Normal file
|
@ -0,0 +1,40 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'puppetdb::server::global', :type => :class do
|
||||
context 'on a supported platform' do
|
||||
let (:facts) do
|
||||
{
|
||||
:osfamily => 'RedHat',
|
||||
:fqdn => 'foo.com',
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_class('puppetdb::server::global') }
|
||||
|
||||
describe 'when using default values' do
|
||||
it { should contain_ini_setting('puppetdb_global_vardir').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => 'opt/puppetlabs/server/data/puppetdb',
|
||||
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
|
||||
'section' => 'global',
|
||||
'setting' => 'vardir',
|
||||
'value' => '/opt/puppetlabs/server/data/puppetdb'
|
||||
)}
|
||||
|
||||
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_global_vardir').
|
||||
with(
|
||||
'ensure' => 'present',
|
||||
'path' => 'opt/puppetlabs/server/data/puppetdb',
|
||||
'path' => '/etc/puppetdb/conf.d/config.ini',
|
||||
'section' => 'global',
|
||||
'setting' => 'vardir',
|
||||
'value' => '/var/lib/puppetdb'
|
||||
)}
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'puppetdb::server::jetty_ini', :type => :class do
|
||||
describe 'puppetdb::server::jetty', :type => :class do
|
||||
context 'on a supported platform' do
|
||||
let(:facts) do
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ describe 'puppetdb::server::jetty_ini', :type => :class do
|
|||
}
|
||||
end
|
||||
|
||||
it { should contain_class('puppetdb::server::jetty_ini') }
|
||||
it { should contain_class('puppetdb::server::jetty') }
|
||||
|
||||
describe 'when using default values' do
|
||||
it { should contain_ini_setting('puppetdb_host').
|
||||
|
@ -158,7 +158,7 @@ describe 'puppetdb::server::jetty_ini', :type => :class do
|
|||
|
||||
it 'should fail' do
|
||||
expect {
|
||||
should contain_class('puppetdb::server::jetty_ini')
|
||||
should contain_class('puppetdb::server::jetty')
|
||||
}.to raise_error(Puppet::Error)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue