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

Enforce Stdlib::Absolutepath for filepaths #1491

Merged
Merged
Show file tree
Hide file tree
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
16 changes: 8 additions & 8 deletions manifests/globals.pp
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@

Optional[String[1]] $validcon_script_path = undef,

Optional[Variant[String[1], Stdlib::Absolutepath]] $initdb_path = undef,
Optional[Variant[String[1], Stdlib::Absolutepath]] $psql_path = undef,
Optional[Variant[String[1], Stdlib::Absolutepath]] $pg_hba_conf_path = undef,
Optional[Variant[String[1], Stdlib::Absolutepath]] $pg_ident_conf_path = undef,
Optional[Variant[String[1], Stdlib::Absolutepath]] $postgresql_conf_path = undef,
Optional[Stdlib::Filemode] $postgresql_conf_mode = undef,
Optional[Variant[String[1], Stdlib::Absolutepath]] $recovery_conf_path = undef,
Hash $default_connect_settings = {},
Optional[Stdlib::Absolutepath] $initdb_path = undef,
Optional[Stdlib::Absolutepath] $psql_path = undef,
Optional[Stdlib::Absolutepath] $pg_hba_conf_path = undef,
Optional[Stdlib::Absolutepath] $pg_ident_conf_path = undef,
Optional[Stdlib::Absolutepath] $postgresql_conf_path = undef,
Optional[Stdlib::Filemode] $postgresql_conf_mode = undef,
Optional[Stdlib::Absolutepath] $recovery_conf_path = undef,
Hash $default_connect_settings = {},

Optional[Boolean] $pg_hba_conf_defaults = undef,

Expand Down
12 changes: 6 additions & 6 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@
Array[String[1]] $ipv4acls = $postgresql::params::ipv4acls,
Array[String[1]] $ipv6acls = $postgresql::params::ipv6acls,

Variant[String[1], Stdlib::Absolutepath] $initdb_path = $postgresql::params::initdb_path,
Variant[String[1], Stdlib::Absolutepath] $psql_path = $postgresql::params::psql_path,
Variant[String[1], Stdlib::Absolutepath] $pg_hba_conf_path = $postgresql::params::pg_hba_conf_path,
Variant[String[1], Stdlib::Absolutepath] $pg_ident_conf_path = $postgresql::params::pg_ident_conf_path,
Variant[String[1], Stdlib::Absolutepath] $postgresql_conf_path = $postgresql::params::postgresql_conf_path,
Stdlib::Absolutepath $initdb_path = $postgresql::params::initdb_path,
Stdlib::Absolutepath $psql_path = $postgresql::params::psql_path,
Stdlib::Absolutepath $pg_hba_conf_path = $postgresql::params::pg_hba_conf_path,
Stdlib::Absolutepath $pg_ident_conf_path = $postgresql::params::pg_ident_conf_path,
Stdlib::Absolutepath $postgresql_conf_path = $postgresql::params::postgresql_conf_path,
Optional[Stdlib::Filemode] $postgresql_conf_mode = $postgresql::params::postgresql_conf_mode,
Variant[String[1], Stdlib::Absolutepath] $recovery_conf_path = $postgresql::params::recovery_conf_path,
Stdlib::Absolutepath $recovery_conf_path = $postgresql::params::recovery_conf_path,

String[1] $datadir = $postgresql::params::datadir,
Optional[String[1]] $xlogdir = $postgresql::params::xlogdir,
Expand Down
18 changes: 9 additions & 9 deletions manifests/server/default_privileges.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
/(?i:^TYPES$)/,
/(?i:^SCHEMAS$)/
] $object_type,
String $schema = 'public',
String $psql_db = $postgresql::server::default_database,
String $psql_user = $postgresql::server::user,
Stdlib::Port $port = $postgresql::server::port,
Hash $connect_settings = $postgresql::server::default_connect_settings,
Enum['present', 'absent'] $ensure = 'present',
String $group = $postgresql::server::group,
Variant[String[1], Stdlib::Absolutepath] $psql_path = $postgresql::server::psql_path,
Optional[String] $target_role = undef,
String $schema = 'public',
String $psql_db = $postgresql::server::default_database,
String $psql_user = $postgresql::server::user,
Stdlib::Port $port = $postgresql::server::port,
Hash $connect_settings = $postgresql::server::default_connect_settings,
Enum['present', 'absent'] $ensure = 'present',
String $group = $postgresql::server::group,
Stdlib::Absolutepath $psql_path = $postgresql::server::psql_path,
Optional[String] $target_role = undef,
) {
# If possible use the version of the remote database, otherwise
# fallback to our local DB version
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/grant.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
Hash $connect_settings = $postgresql::server::default_connect_settings,
Enum['present', 'absent'] $ensure = 'present',
String $group = $postgresql::server::group,
Variant[String[1], Stdlib::Absolutepath] $psql_path = $postgresql::server::psql_path,
Stdlib::Absolutepath $psql_path = $postgresql::server::psql_path,
) {
case $ensure {
default: {
Expand Down
8 changes: 4 additions & 4 deletions manifests/server/instance/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@
Stdlib::Port $port = $postgresql::server::port,
Array[String[1]] $ipv4acls = $postgresql::server::ipv4acls,
Array[String[1]] $ipv6acls = $postgresql::server::ipv6acls,
Variant[String[1], Stdlib::Absolutepath] $pg_hba_conf_path = $postgresql::server::pg_hba_conf_path,
Variant[String[1], Stdlib::Absolutepath] $pg_ident_conf_path = $postgresql::server::pg_ident_conf_path,
Variant[String[1], Stdlib::Absolutepath] $postgresql_conf_path = $postgresql::server::postgresql_conf_path,
Stdlib::Absolutepath $pg_hba_conf_path = $postgresql::server::pg_hba_conf_path,
Stdlib::Absolutepath $pg_ident_conf_path = $postgresql::server::pg_ident_conf_path,
Stdlib::Absolutepath $postgresql_conf_path = $postgresql::server::postgresql_conf_path,
Optional[Stdlib::Filemode] $postgresql_conf_mode = $postgresql::server::postgresql_conf_mode,
Variant[String[1], Stdlib::Absolutepath] $recovery_conf_path = $postgresql::server::recovery_conf_path,
Stdlib::Absolutepath $recovery_conf_path = $postgresql::server::recovery_conf_path,
Boolean $pg_hba_conf_defaults = $postgresql::server::pg_hba_conf_defaults,
String[1] $user = $postgresql::server::user,
String[1] $group = $postgresql::server::group,
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/instance/initdb.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
String[1] $datadir = $postgresql::server::datadir,
Optional[String[1]] $encoding = $postgresql::server::encoding,
String[1] $group = $postgresql::server::group,
Variant[String[1], Stdlib::Absolutepath] $initdb_path = $postgresql::server::initdb_path,
Stdlib::Absolutepath $initdb_path = $postgresql::server::initdb_path,
Optional[String[1]] $lc_messages = $postgresql::server::lc_messages,
Optional[String[1]] $locale = $postgresql::server::locale,
Optional[String[1]] $logdir = $postgresql::server::logdir,
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/instance/late_initdb.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Optional[String[1]] $encoding = $postgresql::server::encoding,
String[1] $user = $postgresql::server::user,
String[1] $group = $postgresql::server::group,
Variant[String[1], Stdlib::Absolutepath] $psql_path = $postgresql::server::psql_path,
Stdlib::Absolutepath $psql_path = $postgresql::server::psql_path,
Stdlib::Port $port = $postgresql::server::port,
String[1] $module_workdir = $postgresql::server::module_workdir,
) {
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/instance/passwd.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
define postgresql::server::instance::passwd (
String[1] $user = $postgresql::server::user,
String[1] $group = $postgresql::server::group,
Variant[String[1], Stdlib::Absolutepath] $psql_path = $postgresql::server::psql_path,
Stdlib::Absolutepath $psql_path = $postgresql::server::psql_path,
Stdlib::Port $port = $postgresql::server::port,
String[1] $database = $postgresql::server::default_database,
String[1] $module_workdir = $postgresql::server::module_workdir,
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/instance/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
String[1] $user = $postgresql::server::user,
Stdlib::Port $port = $postgresql::server::port,
String[1] $default_database = $postgresql::server::default_database,
Variant[String[1], Stdlib::Absolutepath] $psql_path = $postgresql::server::psql_path,
Stdlib::Absolutepath $psql_path = $postgresql::server::psql_path,
Hash $connect_settings = $postgresql::server::default_connect_settings,
) {
anchor { "postgresql::server::service::begin::${name}": }
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/pg_ident_rule.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# Needed for testing primarily, support for multiple files is not really
# working.
Variant[String[1], Stdlib::Absolutepath] $target = $postgresql::server::pg_ident_conf_path
Stdlib::Absolutepath $target = $postgresql::server::pg_ident_conf_path
) {
if $postgresql::server::manage_pg_ident_conf == false {
fail('postgresql::server::manage_pg_ident_conf has been disabled, so this resource is now unused and redundant, either enable that option or remove this resource from your manifests') # lint:ignore:140chars
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/recovery.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
Optional[String[1]] $primary_slot_name = undef,
Optional[String[1]] $trigger_file = undef,
Optional[Integer] $recovery_min_apply_delay = undef,
Variant[String[1], Stdlib::Absolutepath] $target = $postgresql::server::recovery_conf_path
Stdlib::Absolutepath $target = $postgresql::server::recovery_conf_path
) {
if $postgresql::server::manage_recovery_conf == false {
fail('postgresql::server::manage_recovery_conf has been disabled, so this resource is now unused and redundant, either enable that option or remove this resource from your manifests') # lint:ignore:140chars
Expand Down
40 changes: 20 additions & 20 deletions manifests/server/role.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@
# @param hash Specify the hash method for pg password
# @param salt Specify the salt use for the scram-sha-256 encoding password (default username)
define postgresql::server::role (
Boolean $update_password = true,
Variant[Boolean, String, Sensitive[String]] $password_hash = false,
Boolean $createdb = false,
Boolean $createrole = false,
String[1] $db = $postgresql::server::default_database,
Optional[Stdlib::Port] $port = undef,
Boolean $login = true,
Boolean $inherit = true,
Boolean $superuser = false,
Boolean $replication = false,
String[1] $connection_limit = '-1',
String[1] $username = $title,
Hash $connect_settings = $postgresql::server::default_connect_settings,
String[1] $psql_user = $postgresql::server::user,
String[1] $psql_group = $postgresql::server::group,
Variant[String[1], Stdlib::Absolutepath] $psql_path = $postgresql::server::psql_path,
String[1] $module_workdir = $postgresql::server::module_workdir,
Enum['present', 'absent'] $ensure = 'present',
Optional[Enum['md5', 'scram-sha-256']] $hash = undef,
Optional[Variant[String[1], Integer]] $salt = undef,
Boolean $update_password = true,
Variant[Boolean, String, Sensitive[String]] $password_hash = false,
Boolean $createdb = false,
Boolean $createrole = false,
String[1] $db = $postgresql::server::default_database,
Optional[Stdlib::Port] $port = undef,
Boolean $login = true,
Boolean $inherit = true,
Boolean $superuser = false,
Boolean $replication = false,
String[1] $connection_limit = '-1',
String[1] $username = $title,
Hash $connect_settings = $postgresql::server::default_connect_settings,
String[1] $psql_user = $postgresql::server::user,
String[1] $psql_group = $postgresql::server::group,
Stdlib::Absolutepath $psql_path = $postgresql::server::psql_path,
String[1] $module_workdir = $postgresql::server::module_workdir,
Enum['present', 'absent'] $ensure = 'present',
Optional[Enum['md5', 'scram-sha-256']] $hash = undef,
Optional[Variant[String[1], Integer]] $salt = undef,
) {
$password_hash_unsensitive = if $password_hash =~ Sensitive[String] {
$password_hash.unwrap
Expand Down