Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Role Valid Until Date #1624

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions manifests/server/role.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
Boolean $inherit = true,
Boolean $superuser = false,
Boolean $replication = false,
Optional[String[1]] $valid_until = undef,

Check warning on line 38 in manifests/server/role.pp

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 7.24, Ruby Ver: 2.7)

missing documentation for defined type parameter postgresql::server::role::valid_until (check: parameter_documentation)

Check warning on line 38 in manifests/server/role.pp

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 7.24, Ruby Ver: 2.7)

missing documentation for defined type parameter postgresql::server::role::valid_until (check: parameter_documentation)

Check warning on line 38 in manifests/server/role.pp

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 8.0, Ruby Ver: 3.2)

missing documentation for defined type parameter postgresql::server::role::valid_until (check: parameter_documentation)

Check warning on line 38 in manifests/server/role.pp

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 8.0, Ruby Ver: 3.2)

missing documentation for defined type parameter postgresql::server::role::valid_until (check: parameter_documentation)
String[1] $connection_limit = '-1',
String[1] $username = $title,
Hash $connect_settings = $postgresql::server::default_connect_settings,
Expand Down Expand Up @@ -126,6 +127,12 @@
unless => "SELECT 1 FROM pg_roles WHERE rolname = '${username}' AND rolinherit = ${inherit}",
}

if $valid_until {
postgresql_psql { "ALTER ROLE \"${username}\" VALID UNTIL '${valid_until}'":
unless => "SELECT 1 FROM pg_roles WHERE rolname = '${username}' AND rolvaliduntil = '${valid_until}'",
}
}

if(versioncmp($version, '9.1') >= 0) {
if $replication_sql == '' {
postgresql_psql { "ALTER ROLE \"${username}\" NOREPLICATION":
Expand Down
Loading