diff --git a/manifests/server.pp b/manifests/server.pp index 71936b790f..1971adfa24 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -196,6 +196,9 @@ #Deprecated Optional[String[1]] $version = undef, ) inherits postgresql::params { + if $port =~ String { + deprecation('postgres_port', 'Passing a string to the port parameter is deprecated. Stdlib::Port will be the enforced datatype in the next major release') + } if $version != undef { warning('Passing "version" to postgresql::server is deprecated; please use postgresql::globals instead.') $_version = $version diff --git a/manifests/server/default_privileges.pp b/manifests/server/default_privileges.pp index cef1d541d9..5dad6bbab0 100644 --- a/manifests/server/default_privileges.pp +++ b/manifests/server/default_privileges.pp @@ -35,6 +35,9 @@ Variant[String[1], Stdlib::Absolutepath] $psql_path = $postgresql::server::psql_path, Optional[String] $target_role = undef, ) { + if $port =~ String { + deprecation('postgres_port', 'Passing a string to the port parameter is deprecated. Stdlib::Port will be the enforced datatype in the next major release') + } # If possible use the version of the remote database, otherwise # fallback to our local DB version if $connect_settings != undef and 'DBVERSION' in $connect_settings { diff --git a/manifests/server/extension.pp b/manifests/server/extension.pp index 9594d9c388..c64eb11da7 100644 --- a/manifests/server/extension.pp +++ b/manifests/server/extension.pp @@ -33,6 +33,9 @@ Hash $connect_settings = postgresql::default('default_connect_settings'), String[1] $database_resource_name = $database, ) { + if $port =~ String { + deprecation('postgres_port', 'Passing a string to the port parameter is deprecated. Stdlib::Port will be the enforced datatype in the next major release') + } $user = postgresql::default('user') $group = postgresql::default('group') $psql_path = postgresql::default('psql_path') diff --git a/manifests/server/grant.pp b/manifests/server/grant.pp index 56ee563330..5b72b33bbd 100644 --- a/manifests/server/grant.pp +++ b/manifests/server/grant.pp @@ -48,6 +48,9 @@ String $group = $postgresql::server::group, Variant[String[1], Stdlib::Absolutepath] $psql_path = $postgresql::server::psql_path, ) { + if $port =~ String { + deprecation('postgres_port', 'Passing a string to the port parameter is deprecated. Stdlib::Port will be the enforced datatype in the next major release') + } case $ensure { default: { # default is 'present' diff --git a/manifests/server/grant_role.pp b/manifests/server/grant_role.pp index 6f507a9b34..9256f06995 100644 --- a/manifests/server/grant_role.pp +++ b/manifests/server/grant_role.pp @@ -16,6 +16,9 @@ Variant[String[1], Stdlib::Port] $port = $postgresql::server::port, Hash $connect_settings = $postgresql::server::default_connect_settings, ) { + if $port =~ String { + deprecation('postgres_port', 'Passing a string to the port parameter is deprecated. Stdlib::Port will be the enforced datatype in the next major release') + } case $ensure { 'present': { $command = "GRANT \"${group}\" TO \"${role}\"" diff --git a/manifests/server/instance/config.pp b/manifests/server/instance/config.pp index f34f896aaa..55e55d85ef 100644 --- a/manifests/server/instance/config.pp +++ b/manifests/server/instance/config.pp @@ -73,6 +73,9 @@ Optional[Postgresql::Pg_password_encryption] $password_encryption = $postgresql::server::password_encryption, Optional[String] $extra_systemd_config = $postgresql::server::extra_systemd_config, ) { + if $port =~ String { + deprecation('postgres_port', 'Passing a string to the port parameter is deprecated. Stdlib::Port will be the enforced datatype in the next major release') + } if ($manage_pg_hba_conf == true) { # Prepare the main pg_hba file concat { $pg_hba_conf_path: diff --git a/manifests/server/instance/late_initdb.pp b/manifests/server/instance/late_initdb.pp index dcec18b63a..43a1d404ce 100644 --- a/manifests/server/instance/late_initdb.pp +++ b/manifests/server/instance/late_initdb.pp @@ -19,6 +19,9 @@ Variant[String[1], Stdlib::Port] $port = $postgresql::server::port, String[1] $module_workdir = $postgresql::server::module_workdir, ) { + if $port =~ String { + deprecation('postgres_port', 'Passing a string to the port parameter is deprecated. Stdlib::Port will be the enforced datatype in the next major release') + } # Set the defaults for the postgresql_psql resource Postgresql_psql { psql_user => $user, diff --git a/manifests/server/instance/passwd.pp b/manifests/server/instance/passwd.pp index 526d55a9e4..97d4a2b01c 100644 --- a/manifests/server/instance/passwd.pp +++ b/manifests/server/instance/passwd.pp @@ -22,6 +22,9 @@ String[1] $module_workdir = $postgresql::server::module_workdir, Optional[Variant[String[1], Sensitive[String[1]], Integer]] $postgres_password = $postgresql::server::postgres_password, ) { + if $port =~ String { + deprecation('postgres_port', 'Passing a string to the port parameter is deprecated. Stdlib::Port will be the enforced datatype in the next major release') + } $real_postgres_password = if $postgres_password =~ Sensitive { $postgres_password.unwrap } else { diff --git a/manifests/server/instance/service.pp b/manifests/server/instance/service.pp index 48f5c603e7..f690245e9b 100644 --- a/manifests/server/instance/service.pp +++ b/manifests/server/instance/service.pp @@ -30,6 +30,9 @@ Variant[String[1], Stdlib::Absolutepath] $psql_path = $postgresql::server::psql_path, Hash $connect_settings = $postgresql::server::default_connect_settings, ) { + if $port =~ String { + deprecation('postgres_port', 'Passing a string to the port parameter is deprecated. Stdlib::Port will be the enforced datatype in the next major release') + } anchor { "postgresql::server::service::begin::${name}": } if $service_manage { diff --git a/manifests/server/instance/systemd.pp b/manifests/server/instance/systemd.pp index 9d7302882f..ddda18cdf7 100644 --- a/manifests/server/instance/systemd.pp +++ b/manifests/server/instance/systemd.pp @@ -10,6 +10,9 @@ Enum[present, absent] $drop_in_ensure = 'present', ) { + if $port =~ String { + deprecation('postgres_port', 'Passing a string to the port parameter is deprecated. Stdlib::Port will be the enforced datatype in the next major release') + } # Template uses: # - $port # - $datadir diff --git a/manifests/server/reassign_owned_by.pp b/manifests/server/reassign_owned_by.pp index 314381336f..3e07e52686 100644 --- a/manifests/server/reassign_owned_by.pp +++ b/manifests/server/reassign_owned_by.pp @@ -16,6 +16,9 @@ Variant[String[1], Stdlib::Port] $port = $postgresql::server::port, Hash $connect_settings = $postgresql::server::default_connect_settings, ) { + if $port =~ String { + deprecation('postgres_port', 'Passing a string to the port parameter is deprecated. Stdlib::Port will be the enforced datatype in the next major release') + } $sql_command = "REASSIGN OWNED BY \"${old_role}\" TO \"${new_role}\"" $group = $postgresql::server::group diff --git a/manifests/server/role.pp b/manifests/server/role.pp index 968e806d5b..cec244af6c 100644 --- a/manifests/server/role.pp +++ b/manifests/server/role.pp @@ -45,6 +45,9 @@ Optional[Enum['md5', 'scram-sha-256']] $hash = undef, Optional[Variant[String[1], Integer]] $salt = undef, ) { + if $port =~ String { + deprecation('postgres_port', 'Passing a string to the port parameter is deprecated. Stdlib::Port will be the enforced datatype in the next major release') + } $password_hash_unsensitive = if $password_hash =~ Sensitive[String] { $password_hash.unwrap } else { diff --git a/manifests/server/table_grant.pp b/manifests/server/table_grant.pp index 69a1afa91d..cc623fe428 100644 --- a/manifests/server/table_grant.pp +++ b/manifests/server/table_grant.pp @@ -25,6 +25,9 @@ Optional[Hash] $connect_settings = undef, Boolean $onlyif_exists = false, ) { + if $port =~ String { + deprecation('postgres_port', 'Passing a string to the port parameter is deprecated. Stdlib::Port will be the enforced datatype in the next major release') + } postgresql::server::grant { "table:${name}": ensure => $ensure, role => $role, diff --git a/spec/acceptance/alternative_port_spec.rb b/spec/acceptance/alternative_port_spec.rb index 125fbd3f3a..57ac64cf70 100644 --- a/spec/acceptance/alternative_port_spec.rb +++ b/spec/acceptance/alternative_port_spec.rb @@ -7,7 +7,7 @@ describe 'postgresql::server' do it 'on an alternative port' do pp = <<-MANIFEST - class { 'postgresql::server': port => '55433', manage_selinux => true } + class { 'postgresql::server': port => 55433, manage_selinux => true } MANIFEST if os[:family] == 'redhat' && os[:release].start_with?('8') apply_manifest(pp, expect_failures: false) diff --git a/spec/defines/server/extension_spec.rb b/spec/defines/server/extension_spec.rb index 251f45a990..68a161584b 100644 --- a/spec/defines/server/extension_spec.rb +++ b/spec/defines/server/extension_spec.rb @@ -198,7 +198,7 @@ extension: 'pg_repack', connect_settings: { 'PGHOST' => 'postgres-db-server', 'DBVERSION' => '9.1', - 'PGPORT' => '1234' } + 'PGPORT' => 1234 } } end @@ -222,7 +222,7 @@ extension: 'pg_repack', connect_settings: { 'PGHOST' => 'postgres-db-server', 'DBVERSION' => '9.1', - 'PGPORT' => '1234' }, + 'PGPORT' => 1234 }, port: 5678 } end diff --git a/spec/defines/server/grant_role_spec.rb b/spec/defines/server/grant_role_spec.rb index 31d45f7c8c..016255aa70 100644 --- a/spec/defines/server/grant_role_spec.rb +++ b/spec/defines/server/grant_role_spec.rb @@ -31,7 +31,7 @@ let(:params) do super().merge(psql_db: 'postgres', psql_user: 'postgres', - port: '5432') + port: 5432) end it {