Skip to content

Commit 2990f80

Browse files
committed
(PDB-1913) manage vardir
This updates the module to manage vardir, and also makes room for general management of the global ini section.
1 parent db91599 commit 2990f80

12 files changed

Lines changed: 108 additions & 44 deletions

manifests/params.pp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,24 @@
7070
case $::osfamily {
7171
'RedHat', 'Suse', 'Archlinux','Debian': {
7272
$confdir = '/etc/puppetdb/conf.d'
73-
$database_embedded_path = '/var/lib/puppetdb/db/db'
73+
$vardir = '/var/lib/puppetdb'
74+
$database_embedded_path = '${vardir}/db/db'
7475
$puppet_confdir = pick($settings::confdir,'/etc/puppet')
7576
$puppet_service_name = 'puppetmaster'
7677
$ssl_dir = '/etc/puppetdb/ssl'
7778
}
7879
'OpenBSD': {
7980
$confdir = '/etc/puppetdb/conf.d'
80-
$database_embedded_path = '/var/db/puppetdb/db/db'
81+
$vardir = '/var/db/puppetdb'
82+
$database_embedded_path = '${vardir}/db/db'
8183
$puppet_confdir = pick($settings::confdir,'/etc/puppet')
8284
$puppet_service_name = 'puppetmasterd'
8385
$ssl_dir = '/etc/puppetdb/ssl'
8486
}
8587
'FreeBSD': {
8688
$confdir = '/usr/local/etc/puppetdb/conf.d'
87-
$database_embedded_path = '/var/db/puppetdb/db/db'
89+
$vardir = '/var/db/puppetdb'
90+
$database_embedded_path = '${vardir}/db/db'
8891
$puppet_confdir = pick($settings::confdir,'/usr/local/etc/puppet')
8992
$puppet_service_name = 'puppetmaster'
9093
$ssl_dir = '/usr/local/etc/puppetdb/ssl'
@@ -115,7 +118,8 @@
115118
}
116119
$terminus_package = 'puppetdb-termini'
117120
$test_url = '/pdb/meta/v1/version'
118-
$database_embedded_path = '/opt/puppetlabs/server/data/puppetdb/db/db'
121+
$vardir = '/opt/puppetlabs/server/data/puppetdb'
122+
$database_embedded_path = '${vardir}/db/db'
119123
}
120124

121125
case $::osfamily {

manifests/server.pp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@
131131
}
132132
}
133133

134-
class { 'puppetdb::server::config_ini':
134+
class { 'puppetdb::server::command_processing':
135135
command_threads => $command_threads,
136136
store_usage => $store_usage,
137137
temp_usage => $temp_usage,
138138
confdir => $confdir,
139139
notify => Service[$puppetdb_service],
140140
}
141141

142-
class { 'puppetdb::server::database_ini':
142+
class { 'puppetdb::server::database':
143143
database => $database,
144144
database_host => $database_host,
145145
database_port => $database_port,
@@ -162,7 +162,7 @@
162162
notify => Service[$puppetdb_service],
163163
}
164164

165-
class { 'puppetdb::server::read_database_ini':
165+
class { 'puppetdb::server::read_database':
166166
database => $read_database,
167167
database_host => $read_database_host,
168168
database_port => $read_database_port,
@@ -218,7 +218,7 @@
218218
}
219219
}
220220

221-
class { 'puppetdb::server::jetty_ini':
221+
class { 'puppetdb::server::jetty':
222222
listen_address => $listen_address,
223223
listen_port => $listen_port,
224224
ssl_listen_address => $ssl_listen_address,
@@ -258,17 +258,17 @@
258258
if $manage_firewall {
259259
Package[$puppetdb_package] ->
260260
Class['puppetdb::server::firewall'] ->
261-
Class['puppetdb::server::config_ini'] ->
262-
Class['puppetdb::server::database_ini'] ->
263-
Class['puppetdb::server::read_database_ini'] ->
264-
Class['puppetdb::server::jetty_ini'] ->
261+
Class['puppetdb::server::command_processing'] ->
262+
Class['puppetdb::server::database'] ->
263+
Class['puppetdb::server::read_database'] ->
264+
Class['puppetdb::server::jetty'] ->
265265
Service[$puppetdb_service]
266266
} else {
267267
Package[$puppetdb_package] ->
268-
Class['puppetdb::server::config_ini'] ->
269-
Class['puppetdb::server::database_ini'] ->
270-
Class['puppetdb::server::read_database_ini'] ->
271-
Class['puppetdb::server::jetty_ini'] ->
268+
Class['puppetdb::server::command_processing'] ->
269+
Class['puppetdb::server::database'] ->
270+
Class['puppetdb::server::read_database'] ->
271+
Class['puppetdb::server::jetty'] ->
272272
Service[$puppetdb_service]
273273
}
274274
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# PRIVATE CLASS - do not use directly
2-
class puppetdb::server::config_ini (
2+
class puppetdb::server::command_processing (
33
$command_threads = $puppetdb::params::command_threads,
44
$store_usage = $puppetdb::params::store_usage,
55
$temp_usage = $puppetdb::params::temp_usage,
@@ -21,36 +21,36 @@
2121
}
2222

2323
if $command_threads {
24-
ini_setting { 'puppetdb_config_command_processing_threads':
24+
ini_setting { 'puppetdb_command_processing_threads':
2525
setting => 'threads',
2626
value => $command_threads,
2727
}
2828
} else {
29-
ini_setting { 'puppetdb_config_command_processing_threads':
29+
ini_setting { 'puppetdb_command_processing_threads':
3030
ensure => 'absent',
3131
setting => 'threads',
3232
}
3333
}
3434

3535
if $store_usage {
36-
ini_setting { 'puppetdb_config_command_processing_store_usage':
36+
ini_setting { 'puppetdb_command_processing_store_usage':
3737
setting => 'store-usage',
3838
value => $store_usage,
3939
}
4040
} else {
41-
ini_setting { 'puppetdb_config_command_processing_store_usage':
41+
ini_setting { 'puppetdb_command_processing_store_usage':
4242
ensure => 'absent',
4343
setting => 'store-usage',
4444
}
4545
}
4646

4747
if $temp_usage {
48-
ini_setting { 'puppetdb_config_command_processing_temp_usage':
48+
ini_setting { 'puppetdb_command_processing_temp_usage':
4949
setting => 'temp-usage',
5050
value => $temp_usage,
5151
}
5252
} else {
53-
ini_setting { 'puppetdb_config_command_processing_temp_usage':
53+
ini_setting { 'puppetdb_command_processing_temp_usage':
5454
ensure => 'absent',
5555
setting => 'temp-usage',
5656
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# PRIVATE CLASS - do not use directly
2-
class puppetdb::server::database_ini (
2+
class puppetdb::server::database (
33
$database = $puppetdb::params::database,
44
$database_host = $puppetdb::params::database_host,
55
$database_port = $puppetdb::params::database_port,

manifests/server/global.pp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# PRIVATE CLASS - do not use directly
2+
class puppetdb::server::global (
3+
$vardir = $puppetdb::params::vardir,
4+
) inherits puppetdb::params {
5+
6+
# Set the defaults
7+
Ini_setting {
8+
path => "${confdir}/config.ini",
9+
ensure => 'present',
10+
section => 'global',
11+
require => File["${confdir}/config.ini"],
12+
}
13+
14+
if $vardir {
15+
ini_setting { 'puppetdb_global_vardir':
16+
setting => 'vardir',
17+
value => $vardir,
18+
}
19+
}
20+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# PRIVATE CLASS - do not use directly
2-
class puppetdb::server::jetty_ini (
2+
class puppetdb::server::jetty (
33
$listen_address = $puppetdb::params::listen_address,
44
$listen_port = $puppetdb::params::listen_port,
55
$ssl_listen_address = $puppetdb::params::ssl_listen_address,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# PRIVATE CLASS - do not use directly
2-
class puppetdb::server::read_database_ini (
2+
class puppetdb::server::read_database (
33
$database = $puppetdb::params::read_database,
44
$database_host = $puppetdb::params::read_database_host,
55
$database_port = $puppetdb::params::read_database_port,

spec/unit/classes/server/config_ini_spec.rb renamed to spec/unit/classes/server/command_processing_spec.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
require 'spec_helper'
22

3-
describe 'puppetdb::server::config_ini', :type => :class do
3+
describe 'puppetdb::server::command_processing', :type => :class do
44
context 'on a supported platform' do
55
let(:facts) do
66
{
77
:osfamily => 'OpenBSD',
88
}
99
end
1010

11-
it { should contain_class('puppetdb::server::config_ini') }
11+
it { should contain_class('puppetdb::server::command_processing') }
1212

1313
describe 'when using default values' do
14-
it { should contain_ini_setting('puppetdb_config_command_processing_threads').
14+
it { should contain_ini_setting('puppetdb_command_processing_threads').
1515
with(
1616
'ensure' => 'absent',
1717
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
1818
'section' => 'command-processing',
1919
'setting' => 'threads'
2020
)}
21-
it { should contain_ini_setting('puppetdb_config_command_processing_store_usage').
21+
it { should contain_ini_setting('puppetdb_command_processing_store_usage').
2222
with(
2323
'ensure' => 'absent',
2424
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
2525
'section' => 'command-processing',
2626
'setting' => 'store-usage'
2727
)}
28-
it { should contain_ini_setting('puppetdb_config_command_processing_temp_usage').
28+
it { should contain_ini_setting('puppetdb_command_processing_temp_usage').
2929
with(
3030
'ensure' => 'absent',
3131
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
@@ -36,21 +36,21 @@
3636

3737
describe 'when using legacy PuppetDB' do
3838
let (:pre_condition) { 'class { "puppetdb::globals": version => "2.2.0", }' }
39-
it { should contain_ini_setting('puppetdb_config_command_processing_threads').
39+
it { should contain_ini_setting('puppetdb_command_processing_threads').
4040
with(
4141
'ensure' => 'absent',
4242
'path' => '/etc/puppetdb/conf.d/config.ini',
4343
'section' => 'command-processing',
4444
'setting' => 'threads'
4545
)}
46-
it { should contain_ini_setting('puppetdb_config_command_processing_store_usage').
46+
it { should contain_ini_setting('puppetdb_command_processing_store_usage').
4747
with(
4848
'ensure' => 'absent',
4949
'path' => '/etc/puppetdb/conf.d/config.ini',
5050
'section' => 'command-processing',
5151
'setting' => 'store-usage'
5252
)}
53-
it { should contain_ini_setting('puppetdb_config_command_processing_temp_usage').
53+
it { should contain_ini_setting('puppetdb_command_processing_temp_usage').
5454
with(
5555
'ensure' => 'absent',
5656
'path' => '/etc/puppetdb/conf.d/config.ini',
@@ -67,23 +67,23 @@
6767
'temp_usage' => 2000,
6868
}
6969
end
70-
it { should contain_ini_setting('puppetdb_config_command_processing_threads').
70+
it { should contain_ini_setting('puppetdb_command_processing_threads').
7171
with(
7272
'ensure' => 'present',
7373
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
7474
'section' => 'command-processing',
7575
'setting' => 'threads',
7676
'value' => '10'
7777
)}
78-
it { should contain_ini_setting('puppetdb_config_command_processing_store_usage').
78+
it { should contain_ini_setting('puppetdb_command_processing_store_usage').
7979
with(
8080
'ensure' => 'present',
8181
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',
8282
'section' => 'command-processing',
8383
'setting' => 'store-usage',
8484
'value' => '4000'
8585
)}
86-
it { should contain_ini_setting('puppetdb_config_command_processing_temp_usage').
86+
it { should contain_ini_setting('puppetdb_command_processing_temp_usage').
8787
with(
8888
'ensure' => 'present',
8989
'path' => '/etc/puppetlabs/puppetdb/conf.d/config.ini',

spec/unit/classes/server/database_ini_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

3-
describe 'puppetdb::server::database_ini', :type => :class do
3+
describe 'puppetdb::server::database', :type => :class do
44
context 'on a supported platform' do
55
let(:facts) do
66
{
@@ -11,7 +11,7 @@
1111
}
1212
end
1313

14-
it { should contain_class('puppetdb::server::database_ini') }
14+
it { should contain_class('puppetdb::server::database') }
1515

1616
describe 'when using default values' do
1717
it { should contain_ini_setting('puppetdb_psdatabase_username').

spec/unit/classes/server/db_connection_uri_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'spec_helper'
22

3-
describe 'puppetdb::server::database_ini', :type => :class do
3+
describe 'puppetdb::server::database', :type => :class do
44
context 'on a supported platform' do
55
let(:facts) do
66
{
@@ -56,7 +56,7 @@
5656
end
5757
end
5858

59-
describe 'puppetdb::server::read_database_ini', :type => :class do
59+
describe 'puppetdb::server::read_database', :type => :class do
6060
context 'on a supported platform' do
6161
let(:facts) do
6262
{

0 commit comments

Comments
 (0)