Skip to content

Commit

Permalink
make gpgsql-password optional
Browse files Browse the repository at this point in the history
At least for postgresql it's not required that the database_user has a
password.
  • Loading branch information
bastelfreak committed Sep 19, 2022
1 parent 43fdad2 commit b53d3cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 7 additions & 5 deletions manifests/backends/postgresql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@
type => 'authoritative',
}

powerdns::config { 'gpgsql-password':
ensure => present,
setting => 'gpgsql-password',
value => $::powerdns::db_password,
type => 'authoritative',
if $powerdns::db_password {
powerdns::config { 'gpgsql-password':
ensure => present,
setting => 'gpgsql-password',
value => $::powerdns::db_password,
type => 'authoritative',
}
}

powerdns::config { 'gpgsql-dbname':
Expand Down
3 changes: 2 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Integer[1] $db_port = 3306,
String[1] $db_dir = $::powerdns::params::db_dir,
String[1] $db_file = $::powerdns::params::db_file,
Boolean $require_db_password = true,
String[1] $ldap_host = 'ldap://localhost/',
Optional[String[1]] $ldap_basedn = undef,
String[1] $ldap_method = 'strict',
Expand All @@ -27,7 +28,7 @@
) inherits powerdns::params {
# Do some additional checks. In certain cases, some parameters are no longer optional.
if $authoritative {
if ($::powerdns::backend != 'bind') and ($::powerdns::backend != 'ldap') and ($::powerdns::backend != 'sqlite') {
if ($::powerdns::backend != 'bind') and ($::powerdns::backend != 'ldap') and ($::powerdns::backend != 'sqlite') and $require_db_password {
assert_type(String[1], $db_password) |$expected, $actual| {
fail("'db_password' must be a non-empty string when 'authoritative' == true")
}
Expand Down

0 comments on commit b53d3cd

Please sign in to comment.