Skip to content

Commit ad618e0

Browse files
authored
Merge pull request voxpupuli#9 from voxpupuli/openvox
use OpenVox packages when possible
2 parents 0585b40 + a66ba4a commit ad618e0

File tree

9 files changed

+65
-50
lines changed

9 files changed

+65
-50
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ permissions:
2222
jobs:
2323
puppet:
2424
name: Puppet
25-
uses: voxpupuli/gha-puppet/.github/workflows/basic.yml@v4
25+
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v4

REFERENCE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,7 @@ The following parameters are available in the `puppetdb::database::postgresql` c
919919
* [`listen_addresses`](#-puppetdb--database--postgresql--listen_addresses)
920920
* [`puppetdb_server`](#-puppetdb--database--postgresql--puppetdb_server)
921921
* [`database_name`](#-puppetdb--database--postgresql--database_name)
922+
* [`database_locale`](#-puppetdb--database--postgresql--database_locale)
922923
* [`database_username`](#-puppetdb--database--postgresql--database_username)
923924
* [`database_password`](#-puppetdb--database--postgresql--database_password)
924925
* [`database_port`](#-puppetdb--database--postgresql--database_port)
@@ -963,6 +964,14 @@ Sets the name of the database. Defaults to `puppetdb`.
963964

964965
Default value: `$puppetdb::params::database_name`
965966

967+
##### <a name="-puppetdb--database--postgresql--database_locale"></a>`database_locale`
968+
969+
Data type: `Any`
970+
971+
Sets the locale of the database. Defaults to `C.UTF-8`.
972+
973+
Default value: `$puppetdb::params::database_locale`
974+
966975
##### <a name="-puppetdb--database--postgresql--database_username"></a>`database_username`
967976

968977
Data type: `Any`

manifests/database/postgresql.pp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
# @param database_name
1313
# Sets the name of the database. Defaults to `puppetdb`.
1414
#
15+
# @param database_locale
16+
# Sets the locale of the database. Defaults to `C.UTF-8`.
17+
#
1518
# @param database_username
1619
# Creates a user for access the database. Defaults to `puppetdb`.
1720
#
@@ -74,6 +77,7 @@
7477
$listen_addresses = $puppetdb::params::database_host,
7578
$puppetdb_server = $puppetdb::params::puppetdb_server,
7679
$database_name = $puppetdb::params::database_name,
80+
$database_locale = $puppetdb::params::database_locale,
7781
$database_username = $puppetdb::params::database_username,
7882
Variant[String[1], Sensitive[String[1]]] $database_password = $puppetdb::params::database_password,
7983
$database_port = $puppetdb::params::database_port,
@@ -150,7 +154,7 @@
150154
user => $database_username,
151155
password => $database_password,
152156
encoding => 'UTF8',
153-
locale => 'en_US.UTF-8',
157+
locale => $database_locale,
154158
grant => 'all',
155159
port => $port,
156160
}

manifests/params.pp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
$database_host = 'localhost'
3636
$database_port = '5432'
3737
$database_name = 'puppetdb'
38+
$database_locale = 'C.UTF-8'
3839
$database_username = 'puppetdb'
3940
$database_password = 'puppetdb'
4041
$manage_db_password = true
@@ -113,30 +114,38 @@
113114
$test_url = '/v3/version'
114115
} else {
115116
case fact('os.family') {
116-
'RedHat', 'Suse', 'Archlinux','Debian': {
117+
'Archlinux': {
117118
$puppetdb_package = 'puppetdb'
118119
$terminus_package = 'puppetdb-termini'
119120
$etcdir = '/etc/puppetlabs/puppetdb'
120121
$puppet_confdir = pick($puppetdb::globals::puppet_confdir,'/etc/puppetlabs/puppet')
121122
$puppet_service_name = 'puppetserver'
122123
$vardir = '/opt/puppetlabs/server/data/puppetdb'
123124
}
124-
'OpenBSD': {
125-
$puppetdb_package = 'puppetdb'
126-
$terminus_package = 'puppetdb-termini'
125+
'Debian', 'RedHat', 'Suse': {
126+
$puppetdb_package = 'openvoxdb'
127+
$terminus_package = 'openvoxdb-termini'
127128
$etcdir = '/etc/puppetlabs/puppetdb'
128129
$puppet_confdir = pick($puppetdb::globals::puppet_confdir,'/etc/puppetlabs/puppet')
129-
$puppet_service_name = undef
130+
$puppet_service_name = 'puppetserver'
130131
$vardir = '/opt/puppetlabs/server/data/puppetdb'
131132
}
132133
'FreeBSD': {
133-
$puppetdb_package = inline_epp('puppetdb<%= $puppetdb::params::puppetdb_major_version %>')
134-
$terminus_package = inline_epp('puppetdb-terminus<%= $puppetdb::params::puppetdb_major_version %>')
134+
$puppetdb_package = "openvoxdb-${puppetdb::params::puppetdb_major_version}"
135+
$terminus_package = "openvoxdb-terminus-${puppetdb::params::puppetdb_major_version}"
135136
$etcdir = '/usr/local/etc/puppetdb'
136137
$puppet_confdir = pick($puppetdb::globals::puppet_confdir,'/usr/local/etc/puppet')
137138
$puppet_service_name = 'puppetserver'
138139
$vardir = '/var/db/puppetdb'
139140
}
141+
'OpenBSD': {
142+
$puppetdb_package = 'puppetdb'
143+
$terminus_package = 'puppetdb-termini'
144+
$etcdir = '/etc/puppetlabs/puppetdb'
145+
$puppet_confdir = pick($puppetdb::globals::puppet_confdir,'/etc/puppetlabs/puppet')
146+
$puppet_service_name = undef
147+
$vardir = '/opt/puppetlabs/server/data/puppetdb'
148+
}
140149
default: {
141150
fail("The fact 'os.family' is set to ${fact('os.family')} which is not supported by the puppetdb module.")
142151
}

spec/support/acceptance/shared/puppetdb.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@
33
shared_examples 'puppetdb' do
44
let(:pp) do
55
<<~PP
6-
if $facts['os']['family'] == 'RedHat' {
7-
# Work-around EL systemd in docker bug affecting forked services
8-
file_line { 'puppetdb-unit-remove-pidfile':
9-
path => '/lib/systemd/system/puppetdb.service',
10-
line => '#PIDFile=/run/puppetlabs/puppetdb/puppetdb.pid',
11-
match => '^PIDFile.*',
12-
append_on_no_match => false,
13-
require => Package['puppetdb'],
14-
notify => Service['puppetdb'],
15-
}
16-
}
17-
186
# reduce pgs memory
197
postgresql::server::config_entry { 'max_connections': value => '20' }
208
postgresql::server::config_entry { 'shared_buffers': value => '128kB' }

spec/support/acceptance/shared/puppetserver.pp

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,27 @@
2424
-> Package['disable-dnf-postgresql-module']
2525
-> Package <| tag == 'postgresql' |>
2626
}
27-
28-
# Work-around EL systemd in docker with cgroupsv1? issue and forked services
29-
# Without this, the puppet agent will stall for 300 seconds waiting for
30-
# the service to start... then miserably fail.
31-
# systemd error message:
32-
# New main PID 1411 does not belong to service, and PID file is not
33-
# owned by root. Refusing.
34-
# PIDFile is not needed, but it cannot be reset by a drop-in, therefor the
35-
# original unit must be modified
36-
file_line { 'puppetserver-unit-remove-pidfile':
37-
path => '/lib/systemd/system/puppetserver.service',
38-
line => '#PIDFile=/run/puppetlabs/puppetserver.pid',
39-
match => '^PIDFile.*',
40-
append_on_no_match => false,
41-
require => Package['puppetserver'],
42-
notify => Service['puppetserver'],
43-
}
4427
}
4528

4629
$sysconfdir = $facts['os']['family'] ? {
4730
'Debian' => '/etc/default',
4831
default => '/etc/sysconfig',
4932
}
5033

51-
package { 'puppetserver':
52-
ensure => installed,
34+
case fact('os.family') {
35+
'Archlinux': {
36+
$puppetserver_package = 'puppetserver'
37+
}
38+
'Debian', 'RedHat', 'Suse': {
39+
$puppetserver_package = 'openvox-server'
40+
}
41+
default: {
42+
fail("The fact 'os.family' is set to ${fact('os.family')} which is not supported by the puppetdb module.")
43+
}
5344
}
54-
# savagely disable dropsonde
55-
~> file {
56-
[
57-
'/opt/puppetlabs/server/data/puppetserver/dropsonde/bin/dropsonde',
58-
'/opt/puppetlabs/server/apps/puppetserver/cli/apps/dropsonde',
59-
]:
60-
ensure => absent,
45+
46+
package { $puppetserver_package:
47+
ensure => installed,
6148
}
6249
-> exec { '/opt/puppetlabs/bin/puppetserver ca setup':
6350
creates => '/etc/puppetlabs/puppetserver/ca/ca_crt.pem',

spec/unit/classes/database/postgresql_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
grant: 'all',
6464
port: params[:database_port].to_i,
6565
encoding: 'UTF8',
66-
locale: 'en_US.UTF-8'
66+
locale: 'C.UTF-8'
6767
)
6868
}
6969

spec/unit/classes/master/config_spec.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
context "on #{os}" do
88
let(:facts) { facts }
99

10+
let(:termini_package_name) do
11+
case facts[:os]['family']
12+
when 'Archlinux', 'OpenBSD'
13+
'puppetdb-termini'
14+
when 'Debian', 'RedHat', 'Suse'
15+
'openvoxdb-termini'
16+
end
17+
end
18+
1019
context 'when PuppetDB on remote server' do
1120
context 'when using default values' do
1221
it { is_expected.to compile.with_all_deps }
@@ -62,7 +71,7 @@
6271
end
6372

6473
context 'when using default values' do
65-
it { is_expected.to contain_package('puppetdb-termini').with(ensure: 'present') }
74+
it { is_expected.to contain_package(termini_package_name).with(ensure: 'present') }
6675
it { is_expected.to contain_puppetdb_conn_validator('puppetdb_conn').with(test_url: '/pdb/meta/v1/version') }
6776
end
6877

spec/unit/classes/server_spec.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
end
1515
end
1616

17+
let(:package_name) do
18+
case facts[:os]['family']
19+
when 'Archlinux', 'OpenBSD'
20+
'puppetdb'
21+
when 'Debian', 'RedHat', 'Suse'
22+
'openvoxdb'
23+
end
24+
end
25+
1726
on_supported_os.each do |os, facts|
1827
context "on #{os}" do
1928
let(:facts) { facts }
@@ -28,7 +37,7 @@
2837
it { is_expected.to contain_class('puppetdb::server::puppetdb') }
2938

3039
it {
31-
is_expected.to contain_package('puppetdb').
40+
is_expected.to contain_package(package_name).
3241
that_notifies('Service[puppetdb]')
3342
}
3443

0 commit comments

Comments
 (0)