|
7 | 7 | $database_password = $puppetdb::params::read_database_password, |
8 | 8 | $database_name = $puppetdb::params::read_database_name, |
9 | 9 | $database_ssl = $puppetdb::params::read_database_ssl, |
| 10 | + $database_validate = $puppetdb::params::read_database_validate, |
10 | 11 | $log_slow_statements = $puppetdb::params::read_log_slow_statements, |
11 | 12 | $conn_max_age = $puppetdb::params::read_conn_max_age, |
12 | 13 | $conn_keep_alive = $puppetdb::params::read_conn_keep_alive, |
|
18 | 19 |
|
19 | 20 | # Only add the read database configuration if database host is defined. |
20 | 21 | if $database_host != undef { |
21 | | - # Validate the database connection. If we can't connect, we want to fail |
22 | | - # and skip the rest of the configuration, so that we don't leave puppetdb |
23 | | - # in a broken state. |
24 | | - # |
25 | | - # NOTE: |
26 | | - # Because of a limitation in the postgres module this will break with |
27 | | - # a duplicate declaration if read and write database host+name are the |
28 | | - # same. |
29 | | - class { 'puppetdb::server::validate_read_db': |
30 | | - database => $database, |
31 | | - database_host => $database_host, |
32 | | - database_port => $database_port, |
33 | | - database_username => $database_username, |
34 | | - database_password => $database_password, |
35 | | - database_name => $database_name, |
| 22 | + if str2bool($database_validate) { |
| 23 | + # Validate the database connection. If we can't connect, we want to fail |
| 24 | + # and skip the rest of the configuration, so that we don't leave puppetdb |
| 25 | + # in a broken state. |
| 26 | + # |
| 27 | + # NOTE: |
| 28 | + # Because of a limitation in the postgres module this will break with |
| 29 | + # a duplicate declaration if read and write database host+name are the |
| 30 | + # same. |
| 31 | + class { 'puppetdb::server::validate_read_db': |
| 32 | + database => $database, |
| 33 | + database_host => $database_host, |
| 34 | + database_port => $database_port, |
| 35 | + database_username => $database_username, |
| 36 | + database_password => $database_password, |
| 37 | + database_name => $database_name, |
| 38 | + } |
36 | 39 | } |
37 | 40 |
|
38 | 41 | file { "${confdir}/read_database.ini": |
|
42 | 45 | mode => '0600'; |
43 | 46 | } |
44 | 47 |
|
| 48 | + $ini_setting_require = str2bool($database_validate) ? { |
| 49 | + false => undef, |
| 50 | + default => Class['puppetdb::server::validate_read_db'], |
| 51 | + } |
45 | 52 | # Set the defaults |
46 | 53 | Ini_setting { |
47 | 54 | path => "${confdir}/read_database.ini", |
48 | 55 | ensure => present, |
49 | 56 | section => 'read-database', |
50 | | - require => Class['puppetdb::server::validate_db'], |
| 57 | + require => $ini_setting_require, |
51 | 58 | } |
52 | 59 |
|
53 | 60 | if $database == 'postgres' { |
|
0 commit comments