Skip to content

Commit

Permalink
port: Enforce Stdlib::Port datatype
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Aug 28, 2023
1 parent 56bc346 commit d722f9a
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 30 deletions.
24 changes: 12 additions & 12 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ Default value: `$postgresql::params::listen_addresses`

##### <a name="-postgresql--server--port"></a>`port`

Data type: `Variant[String[1], Stdlib::Port]`
Data type: `Stdlib::Port`

Specifies the port for the PostgreSQL server to listen on.
Note: The same port number is used for all IP addresses the server listens on.
Expand Down Expand Up @@ -1946,7 +1946,7 @@ Default value: `$postgresql::server::psql_path`

##### <a name="-postgresql--server--default_privileges--port"></a>`port`

Data type: `Variant[String[1], Stdlib::Port]`
Data type: `Stdlib::Port`

Specifies the port to access the server. Default value: The default user for the module, usually '5432'.

Expand Down Expand Up @@ -2051,7 +2051,7 @@ Default value: `undef`

##### <a name="-postgresql--server--extension--port"></a>`port`

Data type: `Optional[Variant[String[1], Stdlib::Port]]`
Data type: `Optional[Stdlib::Port]`

Port to use when connecting.

Expand Down Expand Up @@ -2178,7 +2178,7 @@ Default value: `$postgresql::server::user`

##### <a name="-postgresql--server--grant--port"></a>`port`

Data type: `Variant[String[1], Stdlib::Port]`
Data type: `Stdlib::Port`

Port to use when connecting.

Expand Down Expand Up @@ -2280,7 +2280,7 @@ Default value: `$postgresql::server::user`

##### <a name="-postgresql--server--grant_role--port"></a>`port`

Data type: `Variant[String[1], Stdlib::Port]`
Data type: `Stdlib::Port`

Port to use when connecting.

Expand Down Expand Up @@ -2361,7 +2361,7 @@ Default value: `$postgresql::server::listen_addresses`

##### <a name="-postgresql--server--instance--config--port"></a>`port`

Data type: `Variant[String[1], Stdlib::Port]`
Data type: `Stdlib::Port`

Specifies the port for the PostgreSQL server to listen on.
Note: The same port number is used for all IP addresses the server listens on. Also, for Red Hat systems and early Debian systems,
Expand Down Expand Up @@ -2785,7 +2785,7 @@ Default value: `$postgresql::server::psql_path`

##### <a name="-postgresql--server--instance--late_initdb--port"></a>`port`

Data type: `Variant[String[1], Stdlib::Port]`
Data type: `Stdlib::Port`

Specifies the port for the PostgreSQL server to listen on.
Note: The same port number is used for all IP addresses the server listens on. Also, for Red Hat systems and early Debian systems,
Expand Down Expand Up @@ -2844,7 +2844,7 @@ Default value: `$postgresql::server::psql_path`

##### <a name="-postgresql--server--instance--passwd--port"></a>`port`

Data type: `Variant[String[1], Stdlib::Port]`
Data type: `Stdlib::Port`

Specifies the port for the PostgreSQL server to listen on.
Note: The same port number is used for all IP addresses the server listens on. Also, for Red Hat systems and early Debian systems,
Expand Down Expand Up @@ -2982,7 +2982,7 @@ Default value: `$postgresql::server::user`

##### <a name="-postgresql--server--instance--service--port"></a>`port`

Data type: `Variant[String[1], Stdlib::Port]`
Data type: `Stdlib::Port`

Specifies the port for the PostgreSQL server to listen on.
Note: The same port number is used for all IP addresses the server listens on. Also, for Red Hat systems and early Debian systems,
Expand Down Expand Up @@ -3219,7 +3219,7 @@ Default value: `$postgresql::server::user`

##### <a name="-postgresql--server--reassign_owned_by--port"></a>`port`

Data type: `Variant[String[1], Stdlib::Port]`
Data type: `Stdlib::Port`

Port to use when connecting.

Expand Down Expand Up @@ -3465,7 +3465,7 @@ Default value: `$postgresql::server::default_database`

##### <a name="-postgresql--server--role--port"></a>`port`

Data type: `Optional[Variant[String[1], Stdlib::Port]]`
Data type: `Optional[Stdlib::Port]`

Port to use when connecting.

Expand Down Expand Up @@ -3700,7 +3700,7 @@ Default value: `undef`

##### <a name="-postgresql--server--table_grant--port"></a>`port`

Data type: `Optional[Variant[String[1], Stdlib::Port]]`
Data type: `Optional[Stdlib::Port]`

Port to use when connecting.

Expand Down
2 changes: 1 addition & 1 deletion manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
String[1] $default_database = $postgresql::params::default_database,
Hash $default_connect_settings = $postgresql::globals::default_connect_settings,
Optional[Variant[String[1], Array[String[1]]]] $listen_addresses = $postgresql::params::listen_addresses,
Variant[String[1], Stdlib::Port] $port = $postgresql::params::port,
Stdlib::Port $port = $postgresql::params::port,
String[1] $ip_mask_deny_postgres_user = $postgresql::params::ip_mask_deny_postgres_user,
String[1] $ip_mask_allow_all_users = $postgresql::params::ip_mask_allow_all_users,
Array[String[1]] $ipv4acls = $postgresql::params::ipv4acls,
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/default_privileges.pp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
String $schema = 'public',
String $psql_db = $postgresql::server::default_database,
String $psql_user = $postgresql::server::user,
Variant[String[1], Stdlib::Port] $port = $postgresql::server::port,
Stdlib::Port $port = $postgresql::server::port,
Hash $connect_settings = $postgresql::server::default_connect_settings,
Enum['present', 'absent'] $ensure = 'present',
String $group = $postgresql::server::group,
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/extension.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
Optional[String[1]] $version = undef,
Enum['present', 'absent'] $ensure = 'present',
Optional[String[1]] $package_name = undef,
Optional[Variant[String[1], Stdlib::Port]] $port = undef,
Optional[Stdlib::Port] $port = undef,
Hash $connect_settings = postgresql::default('default_connect_settings'),
String[1] $database_resource_name = $database,
) {
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/grant.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
Array[String[1],0] $object_arguments = [],
String $psql_db = $postgresql::server::default_database,
String $psql_user = $postgresql::server::user,
Variant[String[1], Stdlib::Port] $port = $postgresql::server::port,
Stdlib::Port $port = $postgresql::server::port,
Boolean $onlyif_exists = false,
Hash $connect_settings = $postgresql::server::default_connect_settings,
Enum['present', 'absent'] $ensure = 'present',
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/grant_role.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Enum['present', 'absent'] $ensure = 'present',
String[1] $psql_db = $postgresql::server::default_database,
String[1] $psql_user = $postgresql::server::user,
Variant[String[1], Stdlib::Port] $port = $postgresql::server::port,
Stdlib::Port $port = $postgresql::server::port,
Hash $connect_settings = $postgresql::server::default_connect_settings,
) {
case $ensure {
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/instance/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
String[1] $ip_mask_deny_postgres_user = $postgresql::server::ip_mask_deny_postgres_user,
String[1] $ip_mask_allow_all_users = $postgresql::server::ip_mask_allow_all_users,
Optional[Variant[String[1], Array[String[1]]]] $listen_addresses = $postgresql::server::listen_addresses,
Variant[String[1], Stdlib::Port] $port = $postgresql::server::port,
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,
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 @@ -16,7 +16,7 @@
String[1] $user = $postgresql::server::user,
String[1] $group = $postgresql::server::group,
Variant[String[1], Stdlib::Absolutepath] $psql_path = $postgresql::server::psql_path,
Variant[String[1], Stdlib::Port] $port = $postgresql::server::port,
Stdlib::Port $port = $postgresql::server::port,
String[1] $module_workdir = $postgresql::server::module_workdir,
) {
# Set the defaults for the postgresql_psql resource
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 @@ -17,7 +17,7 @@
String[1] $user = $postgresql::server::user,
String[1] $group = $postgresql::server::group,
Variant[String[1], Stdlib::Absolutepath] $psql_path = $postgresql::server::psql_path,
Variant[String[1], Stdlib::Port] $port = $postgresql::server::port,
Stdlib::Port $port = $postgresql::server::port,
String[1] $database = $postgresql::server::default_database,
String[1] $module_workdir = $postgresql::server::module_workdir,
Optional[Variant[String[1], Sensitive[String[1]], Integer]] $postgres_password = $postgresql::server::postgres_password,
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 @@ -25,7 +25,7 @@
Optional[String[1]] $service_provider = $postgresql::server::service_provider,
String[1] $service_status = $postgresql::server::service_status,
String[1] $user = $postgresql::server::user,
Variant[String[1], Stdlib::Port] $port = $postgresql::server::port,
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,
Hash $connect_settings = $postgresql::server::default_connect_settings,
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/instance/systemd.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @param drop_in_ensure sets the Systemd drop-in file to present or absent
# @api private
define postgresql::server::instance::systemd (
Variant[String[1], Stdlib::Port] $port,
Stdlib::Port $port,
Stdlib::Absolutepath $datadir,
Optional[String[1]] $extra_systemd_config = undef,
String[1] $service_name = $name,
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/reassign_owned_by.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
String $new_role,
String $db,
String $psql_user = $postgresql::server::user,
Variant[String[1], Stdlib::Port] $port = $postgresql::server::port,
Stdlib::Port $port = $postgresql::server::port,
Hash $connect_settings = $postgresql::server::default_connect_settings,
) {
$sql_command = "REASSIGN OWNED BY \"${old_role}\" TO \"${new_role}\""
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/role.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
Boolean $createdb = false,
Boolean $createrole = false,
String[1] $db = $postgresql::server::default_database,
Optional[Variant[String[1], Stdlib::Port]] $port = undef,
Optional[Stdlib::Port] $port = undef,
Boolean $login = true,
Boolean $inherit = true,
Boolean $superuser = false,
Expand Down
2 changes: 1 addition & 1 deletion manifests/server/table_grant.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
String[1] $db,
String[1] $role,
Optional[Enum['present', 'absent']] $ensure = undef,
Optional[Variant[String[1], Stdlib::Port]] $port = undef,
Optional[Stdlib::Port] $port = undef,
Optional[String[1]] $psql_db = undef,
Optional[String[1]] $psql_user = undef,
Optional[Hash] $connect_settings = undef,
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/alternative_port_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions spec/defines/server/extension_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
extension: 'pg_repack',
connect_settings: { 'PGHOST' => 'postgres-db-server',
'DBVERSION' => '9.1',
'PGPORT' => '1234' }
'PGPORT' => 1234 }
}
end

Expand All @@ -222,7 +222,7 @@
extension: 'pg_repack',
connect_settings: { 'PGHOST' => 'postgres-db-server',
'DBVERSION' => '9.1',
'PGPORT' => '1234' },
'PGPORT' => 1234 },
port: 5678
}
end
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/server/grant_role_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
let(:params) do
super().merge(psql_db: 'postgres',
psql_user: 'postgres',
port: '5432')
port: 5432)
end

it {
Expand Down
2 changes: 1 addition & 1 deletion templates/systemd-override.conf.epp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%- |
Variant[String[1], Stdlib::Port] $port,
Stdlib::Port $port,
Stdlib::Absolutepath $datadir,
Optional[String[1]] $extra_systemd_config,
| -%>
Expand Down

0 comments on commit d722f9a

Please sign in to comment.