Skip to content

Commit 3da561a

Browse files
committed
address pdk validation warnings
1 parent 2539434 commit 3da561a

24 files changed

+60
-86
lines changed

lib/puppet/util/puppetdb_validator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ def attempt_connection
6363
end
6464
rescue StandardError => e
6565
log_error(e.message)
66-
return false
66+
false
6767
end
6868
end

manifests/database/default_read_grant.pp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Private class. Grant read permissions to $database_read_only_username by default, for new tables created by
22
# $database_username.
3-
define puppetdb::database::default_read_grant(
3+
define puppetdb::database::default_read_grant (
44
String $database_name,
55
String $schema,
66
String $database_username,
77
String $database_read_only_username,
88
) {
9-
postgresql_psql {"grant default select permission for ${database_read_only_username}":
9+
postgresql_psql { "grant default select permission for ${database_read_only_username}":
1010
db => $database_name,
1111
command => "ALTER DEFAULT PRIVILEGES
1212
FOR USER \"${database_username}\"
@@ -23,7 +23,7 @@
2323
AND nspname = '${schema}'",
2424
}
2525

26-
postgresql_psql {"grant default usage permission for ${database_read_only_username}":
26+
postgresql_psql { "grant default usage permission for ${database_read_only_username}":
2727
db => $database_name,
2828
command => "ALTER DEFAULT PRIVILEGES
2929
FOR USER \"${database_username}\"
@@ -40,7 +40,7 @@
4040
AND nspname = '${schema}'",
4141
}
4242

43-
postgresql_psql {"grant default execute permission for ${database_read_only_username}":
43+
postgresql_psql { "grant default execute permission for ${database_read_only_username}":
4444
db => $database_name,
4545
command => "ALTER DEFAULT PRIVILEGES
4646
FOR USER \"${database_username}\"

manifests/database/postgresql.pp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@
1919
$read_database_password = $puppetdb::params::read_database_password,
2020
$read_database_host = $puppetdb::params::read_database_host
2121
) inherits puppetdb::params {
22-
2322
if $manage_server {
24-
class { '::postgresql::globals':
23+
class { 'postgresql::globals':
2524
manage_package_repo => $manage_package_repo,
2625
version => $postgres_version,
2726
}
2827
# get the pg server up and running
29-
class { '::postgresql::server':
28+
class { 'postgresql::server':
3029
ip_mask_allow_all_users => '0.0.0.0/0',
3130
listen_addresses => $listen_addresses,
3231
port => scanf($database_port, '%i')[0],
@@ -35,7 +34,7 @@
3534
# We need to create the ssl connection for the read user, when
3635
# manage_database is set to true, or when read_database_host is defined.
3736
# Otherwise we don't create it.
38-
if $manage_database or $read_database_host != undef{
37+
if $manage_database or $read_database_host != undef {
3938
$create_read_user_rule = true
4039
} else {
4140
$create_read_user_rule = false
@@ -52,15 +51,14 @@
5251
postgresql_ssl_key_path => $postgresql_ssl_key_path,
5352
postgresql_ssl_cert_path => $postgresql_ssl_cert_path,
5453
postgresql_ssl_ca_cert_path => $postgresql_ssl_ca_cert_path,
55-
create_read_user_rule => $create_read_user_rule
54+
create_read_user_rule => $create_read_user_rule,
5655
}
5756
}
5857

5958
# Only install pg_trgm extension, if database it is actually managed by the module
6059
if $manage_database {
61-
6260
# get the pg contrib to use pg_trgm extension
63-
class { '::postgresql::server::contrib': }
61+
class { 'postgresql::server::contrib': }
6462

6563
postgresql::server::extension { 'pg_trgm':
6664
database => $database_name,
@@ -97,7 +95,7 @@
9795
read_database_username => $read_database_username,
9896
database_name => $database_name,
9997
password_hash => postgresql::postgresql_password($read_database_username, $read_database_password),
100-
database_owner => $database_username
98+
database_owner => $database_username,
10199
}
102100

103101
-> postgresql_psql { "grant ${read_database_username} role to ${database_username}":

manifests/database/postgresql_ssl_rules.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
address => '0.0.0.0/0',
1414
auth_method => 'cert',
1515
order => 0,
16-
auth_option => "map=${identity_map_key} clientcert=1"
16+
auth_option => "map=${identity_map_key} clientcert=1",
1717
}
1818

1919
postgresql::server::pg_hba_rule { "Allow certificate mapped connections to ${database_name} as ${database_username} (ipv6)":
@@ -23,7 +23,7 @@
2323
address => '::0/0',
2424
auth_method => 'cert',
2525
order => 0,
26-
auth_option => "map=${identity_map_key} clientcert=1"
26+
auth_option => "map=${identity_map_key} clientcert=1",
2727
}
2828

2929
postgresql::server::pg_ident_rule { "Map the SSL certificate of the server as a ${database_username} user":

manifests/database/ssl_configuration.pp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,25 @@
3131
postgresql::server::config_entry { 'ssl':
3232
ensure => present,
3333
value => 'on',
34-
require => [File['postgres private key'], File['postgres public key']]
34+
require => [File['postgres private key'], File['postgres public key']],
3535
}
3636

3737
postgresql::server::config_entry { 'ssl_cert_file':
3838
ensure => present,
3939
value => "${postgresql::server::datadir}/server.crt",
40-
require => [File['postgres private key'], File['postgres public key']]
40+
require => [File['postgres private key'], File['postgres public key']],
4141
}
4242

4343
postgresql::server::config_entry { 'ssl_key_file':
4444
ensure => present,
4545
value => "${postgresql::server::datadir}/server.key",
46-
require => [File['postgres private key'], File['postgres public key']]
46+
require => [File['postgres private key'], File['postgres public key']],
4747
}
4848

4949
postgresql::server::config_entry { 'ssl_ca_file':
5050
ensure => present,
5151
value => $postgresql_ssl_ca_cert_path,
52-
require => [File['postgres private key'], File['postgres public key']]
52+
require => [File['postgres private key'], File['postgres public key']],
5353
}
5454

5555
puppetdb::database::postgresql_ssl_rules { "Configure postgresql ssl rules for ${database_username}":

manifests/globals.pp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
$version = 'present',
44
$database = 'postgres',
55
Stdlib::Absolutepath $puppet_confdir = $settings::confdir,
6-
) {
7-
6+
) {
87
if !(fact('os.family') in ['RedHat', 'Suse', 'Archlinux', 'Debian', 'OpenBSD', 'FreeBSD']) {
98
fail("${module_name} does not support your osfamily ${fact('os.family')}")
109
}
11-
1210
}

manifests/init.pp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@
9191
Integer[1] $dlo_max_age = $puppetdb::params::dlo_max_age,
9292
Optional[Stdlib::Absolutepath] $java_bin = $puppetdb::params::java_bin,
9393
) inherits puppetdb::params {
94-
95-
class { '::puppetdb::server':
94+
class { 'puppetdb::server':
9695
listen_address => $listen_address,
9796
listen_port => $listen_port,
9897
disable_cleartext => $disable_cleartext,
@@ -176,14 +175,15 @@
176175
}
177176

178177
if ($database == 'postgres') {
179-
180178
$database_before = str2bool($database_validate) ? {
181-
false => Class['::puppetdb::server'],
182-
default => [Class['::puppetdb::server'],
183-
Class['::puppetdb::server::validate_db']],
179+
false => Class['puppetdb::server'],
180+
default => [
181+
Class['puppetdb::server'],
182+
Class['puppetdb::server::validate_db']
183+
],
184184
}
185185

186-
class { '::puppetdb::database::postgresql':
186+
class { 'puppetdb::database::postgresql':
187187
listen_addresses => $database_listen_address,
188188
database_name => $database_name,
189189
puppetdb_server => $puppetdb_server,
@@ -201,7 +201,7 @@
201201
read_database_username => $read_database_username,
202202
read_database_password => $read_database_password,
203203
read_database_host => $read_database_host,
204-
before => $database_before
204+
before => $database_before,
205205
}
206206
}
207207
}

manifests/master/config.pp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
class puppetdb::master::config (
33
$puppetdb_server = fact('networking.fqdn'),
44
$puppetdb_port = defined(Class['puppetdb']) ? {
5-
true => $::puppetdb::disable_ssl ? {
5+
true => $puppetdb::disable_ssl ? {
66
true => 8080,
77
default => 8081,
88
},
99
default => 8081,
1010
},
1111
$puppetdb_disable_ssl = defined(Class['puppetdb']) ? {
12-
true => $::puppetdb::disable_ssl,
12+
true => $puppetdb::disable_ssl,
1313
default => false,
1414
},
1515
$masterless = $puppetdb::params::masterless,
@@ -30,7 +30,6 @@
3030
$test_url = $puppetdb::params::test_url,
3131
$restart_puppet = true,
3232
) inherits puppetdb::params {
33-
3433
# **WARNING**: Ugly hack to work around a yum bug with metadata parsing. This
3534
# should not be copied, replicated or even looked at. In short, never rename
3635
# your packages...
@@ -66,7 +65,6 @@
6665
}
6766

6867
if ($strict_validation) {
69-
7068
# Validate the puppetdb connection. If we can't connect to puppetdb then we
7169
# *must* not perform the other configuration steps, or else
7270

@@ -192,5 +190,4 @@
192190
Class['puppetdb::master::report_processor'] ~> Service[$puppet_service_name]
193191
}
194192
}
195-
196193
}

manifests/master/puppetdb_conf.pp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
/(puppetdb-terminus)/ => true,
1313
default => false,
1414
},
15-
) inherits puppetdb::params {
16-
15+
) inherits puppetdb::params {
1716
Ini_setting {
1817
ensure => present,
1918
section => 'main',

manifests/master/report_processor.pp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
$masterless = $puppetdb::params::masterless,
66
$enable = false
77
) inherits puppetdb::params {
8-
98
if $masterless {
109
$puppet_conf_section = 'main'
1110
} else {

0 commit comments

Comments
 (0)