From 2a34104b27fc2854b1ad44c1c62297d533bad0e7 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Mon, 25 Mar 2024 07:56:20 +0100 Subject: [PATCH 01/57] Add support for Ubuntu 24.04 ("Noble Numbat") --- manifests/globals.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/globals.pp b/manifests/globals.pp index a193a962c8..ea025e4f9b 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -211,6 +211,7 @@ /^(20.04)$/ => '12', /^(21.04|21.10)$/ => '13', /^(22.04)$/ => '14', + /^(24.04)$/ => '16', default => undef, }, default => undef, From 265724b3fcefcfc05eaa8338818fecc00498de2b Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Mon, 25 Mar 2024 07:58:24 +0100 Subject: [PATCH 02/57] postgis: support for postgres 16 --- manifests/globals.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/globals.pp b/manifests/globals.pp index ea025e4f9b..b9adfb4820 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -260,6 +260,7 @@ '10' => '2.4', '11' => '3.0', '12' => '3.0', + '16' => '3.4', default => undef, } $globals_postgis_version = $postgis_version ? { From 56dc1d56a00e19f7ab008f745ea72534fe9d8115 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 25 Mar 2024 13:39:13 +0100 Subject: [PATCH 03/57] Use RequiresMountsFor on datadir It is quite common for the data directory to be on its own mount. Systemd can ensure a directory is mounted before a service starts using RequiresMountsFor[1]: > Takes a space-separated list of absolute paths. Automatically adds > dependencies of type Requires= and After= for all mount units required > to access the specified path. [1]: https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#RequiresMountsFor= --- templates/systemd-override.conf.epp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/systemd-override.conf.epp b/templates/systemd-override.conf.epp index 48b02c72f4..e451ce8c88 100644 --- a/templates/systemd-override.conf.epp +++ b/templates/systemd-override.conf.epp @@ -3,6 +3,9 @@ Stdlib::Absolutepath $datadir, Optional[String[1]] $extra_systemd_config, | -%> +[Unit] +RequiresMountsFor=<%= $datadir %> + [Service] Environment=PGPORT=<%= $port %> <%- if $facts['os']['family'] == 'Gentoo' { -%> From 43c21aff1a1e07d8bdc2da211e3503a973ae4034 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 26 Mar 2024 15:29:25 +0100 Subject: [PATCH 04/57] Add a global password_encryption parameter The function postgresql::password() looks at the default for encryption. If you want to use SCRAM on PostgreSQL < 14 then the default must be overridden, or specified for every use. This parameter allows it to be globally overridden. --- manifests/globals.pp | 5 +++++ manifests/params.pp | 2 +- spec/functions/postgresql_default_spec.rb | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/manifests/globals.pp b/manifests/globals.pp index b9adfb4820..6cc149fc3f 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -81,6 +81,10 @@ # @param timezone # Sets the default timezone of the postgresql server. The postgresql built-in default is taking the systems timezone information. # +# @param password_encryption +# Specify the type of encryption set for the password. +# Defaults to scram-sha-256 for PostgreSQL >= 14, otherwise md5. +# # @param manage_pg_hba_conf Allow Puppet to manage the pg_hba.conf file. # @param manage_pg_ident_conf Allow Puppet to manage the pg_ident.conf file. # @param manage_recovery_conf Allow Puppet to manage the recovery.conf file. @@ -159,6 +163,7 @@ Optional[String[1]] $locale = undef, Optional[Boolean] $data_checksums = undef, Optional[String[1]] $timezone = undef, + Optional[Postgresql::Pg_password_encryption] $password_encryption = undef, Optional[Boolean] $manage_pg_hba_conf = undef, Optional[Boolean] $manage_pg_ident_conf = undef, diff --git a/manifests/params.pp b/manifests/params.pp index c777b0793c..8441aa829c 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -25,7 +25,7 @@ $manage_selinux = pick($manage_selinux, false) $package_ensure = 'present' $module_workdir = pick($module_workdir,'/tmp') - $password_encryption = versioncmp($version, '14') ? { -1 => 'md5', default => 'scram-sha-256' } + $password_encryption = pick($password_encryption, versioncmp($version, '14') ? { -1 => 'md5', default => 'scram-sha-256' }) $extra_systemd_config = undef $manage_datadir = true $manage_logdir = true diff --git a/spec/functions/postgresql_default_spec.rb b/spec/functions/postgresql_default_spec.rb index 12ecde207e..a1d0cd6d57 100644 --- a/spec/functions/postgresql_default_spec.rb +++ b/spec/functions/postgresql_default_spec.rb @@ -30,5 +30,19 @@ class { 'postgresql::server': # parameter in globals.pp only it { is_expected.to run.with_params('default_connect_settings').and_return({}) } + it { is_expected.to run.with_params('password_encryption').and_return('md5') } + it { is_expected.to run.with_params('a_parameter_that_does_not_exist').and_raise_error(Puppet::ParseError, %r{pick\(\): must receive at least one non empty value}) } + + context 'with overridden values' do + let(:pre_condition) do + <<~PUPPET + class { 'postgresql::globals': + password_encryption => 'scram-sha-256', + } + PUPPET + end + + it { is_expected.to run.with_params('password_encryption').and_return('scram-sha-256') } + end end From 8caa079a5a8cf378aa48c6bc80fcbfa56b8b378f Mon Sep 17 00:00:00 2001 From: Lucien Weller Date: Mon, 18 Mar 2024 18:01:45 +0100 Subject: [PATCH 05/57] Added Fedora 39 support --- manifests/globals.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/globals.pp b/manifests/globals.pp index 6cc149fc3f..99dce13966 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -180,7 +180,7 @@ $default_version = $facts['os']['family'] ? { /^(RedHat|Linux)/ => $facts['os']['name'] ? { 'Fedora' => $facts['os']['release']['major'] ? { - /^(38)$/ => '15', + /^(38|39)$/ => '15', /^(36|37)$/ => '14', /^(34|35)$/ => '13', /^(32|33)$/ => '12', From c773e918c1cc5ad338f0faa6dfae8a88cca60246 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 26 Mar 2024 18:07:58 +0000 Subject: [PATCH 06/57] Release prep v10.1.0 --- CHANGELOG.md | 15 +++++++++++++++ REFERENCE.md | 10 ++++++++++ metadata.json | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d259b3adc9..089acdb208 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [v10.1.0](https://github.com/puppetlabs/puppetlabs-postgresql/tree/v10.1.0) - 2024-03-26 + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v10.0.3...v10.1.0) + +### Added + +- Add a global password_encryption parameter [#1584](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1584) ([ekohl](https://github.com/ekohl)) +- Use RequiresMountsFor on datadir [#1582](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1582) ([ekohl](https://github.com/ekohl)) +- Support Ubuntu 24.04 and postgis for postgresql 16 [#1581](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1581) ([bmiklautz](https://github.com/bmiklautz)) +- Add Fedora 39 support [#1580](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1580) ([lweller](https://github.com/lweller)) + +### Other + +- Fix typo in postgresql_conf provider docs [#1579](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1579) ([bastelfreak](https://github.com/bastelfreak)) + ## [v10.0.3](https://github.com/puppetlabs/puppetlabs-postgresql/tree/v10.0.3) - 2024-01-09 [Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v10.0.2...v10.0.3) diff --git a/REFERENCE.md b/REFERENCE.md index 4a2b80dd15..64fd7e14b9 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -208,6 +208,7 @@ The following parameters are available in the `postgresql::globals` class: * [`locale`](#-postgresql--globals--locale) * [`data_checksums`](#-postgresql--globals--data_checksums) * [`timezone`](#-postgresql--globals--timezone) +* [`password_encryption`](#-postgresql--globals--password_encryption) * [`manage_pg_hba_conf`](#-postgresql--globals--manage_pg_hba_conf) * [`manage_pg_ident_conf`](#-postgresql--globals--manage_pg_ident_conf) * [`manage_recovery_conf`](#-postgresql--globals--manage_recovery_conf) @@ -584,6 +585,15 @@ Sets the default timezone of the postgresql server. The postgresql built-in defa Default value: `undef` +##### `password_encryption` + +Data type: `Optional[Postgresql::Pg_password_encryption]` + +Specify the type of encryption set for the password. +Defaults to scram-sha-256 for PostgreSQL >= 14, otherwise md5. + +Default value: `undef` + ##### `manage_pg_hba_conf` Data type: `Optional[Boolean]` diff --git a/metadata.json b/metadata.json index ba09de478d..eeed477da8 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-postgresql", - "version": "10.0.3", + "version": "10.1.0", "author": "puppetlabs", "summary": "Offers support for basic management of PostgreSQL databases.", "license": "Apache-2.0", From 7185fd28f5a0cae67e95fc44124cf2393ddd47b1 Mon Sep 17 00:00:00 2001 From: Malik Parvez <84777619+malikparvez@users.noreply.github.com> Date: Tue, 2 Apr 2024 21:09:39 +0530 Subject: [PATCH 07/57] Fix mend to run on cron --- .github/workflows/mend.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mend.yml b/.github/workflows/mend.yml index b4100a5af0..8b5b401847 100644 --- a/.github/workflows/mend.yml +++ b/.github/workflows/mend.yml @@ -1,9 +1,10 @@ name: "mend" on: - pull_request: - branches: - - "main" + pull_request_target: + types: + - opened + - synchronize schedule: - cron: "0 0 * * *" workflow_dispatch: From 3c32db8e7d4ace263ead75e99ae59aa8cdcb7416 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 3 Apr 2024 11:05:01 +0200 Subject: [PATCH 08/57] client.pp: Purge trailing whitespace --- manifests/client.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index 0b15f91fb5..7aa952fddf 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -1,5 +1,5 @@ # @summary Installs PostgreSQL client software. Set the following parameters if you have a custom version you would like to install. -# +# # @note # Make sure to add any necessary yum or apt repositories if specifying a custom version. # @@ -9,7 +9,7 @@ # Optional. Absolute path for the postgresql connection validation script. # @param package_name # Sets the name of the PostgreSQL client package. -# @param package_ensure +# @param package_ensure # Ensure the client package is installed class postgresql::client ( Enum['file', 'absent'] $file_ensure = 'file', From 8aadd09228bf06ba6efa7b8bdf0da4fdf6567bf7 Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Tue, 2 Jan 2024 22:15:07 -0800 Subject: [PATCH 09/57] repo/apt_postgresql_org: use modern APT keyrings This makes use of https://github.com/puppetlabs/puppetlabs-apt/pull/1128 to store the public key in /etc/apt/keyrings and add a signed-by option to the sources.list.d entry. --- files/ACCC4CF8.asc | 77 ++++++++++++++++++++++++++++ manifests/repo/apt_postgresql_org.pp | 5 +- metadata.json | 2 +- 3 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 files/ACCC4CF8.asc diff --git a/files/ACCC4CF8.asc b/files/ACCC4CF8.asc new file mode 100644 index 0000000000..8480576ece --- /dev/null +++ b/files/ACCC4CF8.asc @@ -0,0 +1,77 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +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 +=DA1T +-----END PGP PUBLIC KEY BLOCK----- diff --git a/manifests/repo/apt_postgresql_org.pp b/manifests/repo/apt_postgresql_org.pp index de72f92458..8acd3d3941 100644 --- a/manifests/repo/apt_postgresql_org.pp +++ b/manifests/repo/apt_postgresql_org.pp @@ -22,8 +22,9 @@ repos => 'main', architecture => $facts['os']['architecture'], key => { - id => 'B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8', - source => 'https://www.postgresql.org/media/keys/ACCC4CF8.asc', + name => 'apt.postgresql.org.asc', + # https://www.postgresql.org/media/keys/ACCC4CF8.asc + content => file("${module_name}/ACCC4CF8.asc"), }, include => { src => false, diff --git a/metadata.json b/metadata.json index eeed477da8..1c741d8086 100644 --- a/metadata.json +++ b/metadata.json @@ -14,7 +14,7 @@ }, { "name": "puppetlabs/apt", - "version_requirement": ">= 2.0.0 < 10.0.0" + "version_requirement": ">= 9.2.0 < 10.0.0" }, { "name": "puppet/systemd", From a72c332ad2c9cdafabd4abc95d340ca75c118c2a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 10 Apr 2024 11:07:57 +0200 Subject: [PATCH 10/57] acceptance tests: ensure code is idempotent --- spec/acceptance/server_instance_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/acceptance/server_instance_spec.rb b/spec/acceptance/server_instance_spec.rb index 93192bafb3..d00ce95f83 100644 --- a/spec/acceptance/server_instance_spec.rb +++ b/spec/acceptance/server_instance_spec.rb @@ -156,6 +156,6 @@ class { 'postgresql::server': it 'installs postgres instance test1' do export_locales('en_US.UTF-8 ') - apply_manifest(pp, catch_failures: true) + idempotent_apply(pp) end end From 93bb7d4ff636359ae61a95bfc665bf32447ee8f8 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 10 Apr 2024 16:58:50 +0200 Subject: [PATCH 11/57] .fixtures.yml: unpin puppet_agent dependency --- .fixtures.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 9846440fef..fbee13667e 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,3 +1,4 @@ +--- fixtures: repositories: apt: "https://github.com/puppetlabs/puppetlabs-apt.git" @@ -7,9 +8,7 @@ fixtures: facts: 'https://github.com/puppetlabs/puppetlabs-facts.git' firewall: "https://github.com/puppetlabs/puppetlabs-firewall.git" provision: "https://github.com/puppetlabs/provision.git" - puppet_agent: - repo: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git' - ref: v4.13.0 + puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git' stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git" yumrepo_core: "https://github.com/puppetlabs/puppetlabs-yumrepo_core.git" systemd: "https://github.com/voxpupuli/puppet-systemd.git" From 5b0fb8ca454c2d1e33af74cca6247215a968e9bf Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Thu, 31 Aug 2023 10:22:47 +0200 Subject: [PATCH 12/57] List Debian 12 as supported system --- metadata.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 1c741d8086..9dfec547ad 100644 --- a/metadata.json +++ b/metadata.json @@ -57,7 +57,8 @@ "operatingsystem": "Debian", "operatingsystemrelease": [ "10", - "11" + "11", + "12" ] }, { From b797bbd00bbefdcf84a6eef95f8df02bf0a2572a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 19 Oct 2023 19:28:00 +0200 Subject: [PATCH 13/57] (#1532) Replace ParserError with Puppet::Error I'm not sure how we ended up with ParserError in the provider. This exception doesn't exist in Ruby. Puppet ships ther own exception, Puppet::Error. It probably makes sense to raise that instead. Fixes 179472ba261a7d0847fdb93fdcb1d43741c4cdde Alternative implementation for https://github.com/puppetlabs/puppetlabs-postgresql/pull/1538 --- lib/puppet/provider/postgresql_conf/ruby.rb | 2 +- .../provider/postgresql_conf/ruby_spec.rb | 26 ++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/postgresql_conf/ruby.rb b/lib/puppet/provider/postgresql_conf/ruby.rb index 984b42706b..7e5db35232 100644 --- a/lib/puppet/provider/postgresql_conf/ruby.rb +++ b/lib/puppet/provider/postgresql_conf/ruby.rb @@ -74,7 +74,7 @@ def write_config(file, lines) # check, if resource exists in postgresql.conf file def exists? select = parse_config.select { |hash| hash[:key] == resource[:key] } - raise ParserError, "found multiple config items of #{resource[:key]} found, please fix this" if select.length > 1 + raise Puppet::Error, "found multiple config items of #{resource[:key]}, please fix this" if select.length > 1 return false if select.empty? @result = select.first diff --git a/spec/unit/provider/postgresql_conf/ruby_spec.rb b/spec/unit/provider/postgresql_conf/ruby_spec.rb index 11800b0fc7..1a5c3e806a 100644 --- a/spec/unit/provider/postgresql_conf/ruby_spec.rb +++ b/spec/unit/provider/postgresql_conf/ruby_spec.rb @@ -4,13 +4,14 @@ provider_class = Puppet::Type.type(:postgresql_conf).provider(:ruby) describe provider_class do - let(:resource) { Puppet::Type.type(:postgresql_conf).new(name: 'foo', value: 'bar') } + let(:resource) { Puppet::Type.type(:postgresql_conf).new(name: 'foo', key: 'foo', value: 'bar') } let(:provider) { resource.provider } before(:each) do allow(provider).to receive(:file_path).and_return('/tmp/foo') allow(provider).to receive(:read_file).and_return('foo = bar') allow(provider).to receive(:write_file).and_return(true) + allow(provider).to receive(:resource).and_return(key: 'your_key', line_number: 1, value: 'foo') end # rubocop:enable RSpec/ReceiveMessages @@ -26,8 +27,27 @@ expect(provider).to respond_to(:add_header) end - it 'has a method exists?' do - expect(provider).to respond_to(:exists?) + describe '#exists?' do + it 'returns true when a matching config item is found' do + config_data = [{ key: 'your_key', value: 'your_value' }] + expect(provider).to receive(:parse_config).and_return(config_data) + + expect(provider.exists?).to be true + end + + it 'returns false when no matching config item is found' do + config_data = [{ key: 'other_key', value: 'other_value' }] + expect(provider).to receive(:parse_config).and_return(config_data) + + expect(provider.exists?).to be false + end + + it 'raises an error when multiple matching config items are found' do + config_data = [{ key: 'your_key', value: 'value1' }, { key: 'your_key', value: 'value2' }] + expect(provider).to receive(:parse_config).and_return(config_data) + + expect { provider.exists? }.to raise_error(Puppet::Error, 'found multiple config items of your_key, please fix this') + end end it 'has a method create' do From 26a3e8ebf4eb566cbf7f0dd89dd072629568c2dd Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 11 Apr 2024 07:40:50 +0000 Subject: [PATCH 14/57] Release prep v10.2.0 --- CHANGELOG.md | 13 +++++++++++++ metadata.json | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 089acdb208..df8d39278e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [v10.2.0](https://github.com/puppetlabs/puppetlabs-postgresql/tree/v10.2.0) - 2024-04-11 + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v10.1.0...v10.2.0) + +### Added + +- Use modern APT keyrings on Debian family; require puppetlabs/apt 9.2 [#1563](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1563) ([kenyon](https://github.com/kenyon)) +- List Debian 12 as supported system [#1488](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1488) ([deric](https://github.com/deric)) + +### Fixed + +- acceptance tests: ensure code is idempotent [#1589](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1589) ([bastelfreak](https://github.com/bastelfreak)) + ## [v10.1.0](https://github.com/puppetlabs/puppetlabs-postgresql/tree/v10.1.0) - 2024-03-26 [Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v10.0.3...v10.1.0) diff --git a/metadata.json b/metadata.json index 9dfec547ad..348ca30e5e 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-postgresql", - "version": "10.1.0", + "version": "10.2.0", "author": "puppetlabs", "summary": "Offers support for basic management of PostgreSQL databases.", "license": "Apache-2.0", From d383a21524178f2ee997cf355a7287610c7c7fa9 Mon Sep 17 00:00:00 2001 From: Simon Hoenscheid Date: Wed, 3 Apr 2024 15:44:09 +0200 Subject: [PATCH 15/57] fix service reload for correctinstance in server::instance::config define --- manifests/server/instance/config.pp | 4 ++-- manifests/server_instance.pp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/manifests/server/instance/config.pp b/manifests/server/instance/config.pp index d596d0846b..342d8fdba3 100644 --- a/manifests/server/instance/config.pp +++ b/manifests/server/instance/config.pp @@ -88,7 +88,7 @@ group => $group, mode => '0640', warn => true, - notify => Class['postgresql::server::reload'], + notify => Postgresql::Server::Instance::Reload[$name], } if $pg_hba_conf_defaults { @@ -249,7 +249,7 @@ group => $group, mode => '0640', warn => true, - notify => Class['postgresql::server::reload'], + notify => Postgresql::Server::Instance::Reload[$name], } } diff --git a/manifests/server_instance.pp b/manifests/server_instance.pp index 49d2bbb8f7..9f45b419f2 100644 --- a/manifests/server_instance.pp +++ b/manifests/server_instance.pp @@ -66,6 +66,10 @@ port => $config_settings['port'], user => $instance_user, } + postgresql::server::instance::reload { $instance_name: + service_status => $service_settings['service_status'], + service_reload => "systemctl reload ${service_settings['service_name']}.service", + } postgresql::server::instance::passwd { $instance_name: * => $passwd_settings, } From 4cff9edb82d88075ea7fa8b6740ca7522440bbec Mon Sep 17 00:00:00 2001 From: Simon Hoenscheid Date: Wed, 3 Apr 2024 15:49:56 +0200 Subject: [PATCH 16/57] fix service reload/restart for correct nstance in server::instance::reload/systemd define --- manifests/server/instance/reload.pp | 2 +- manifests/server/instance/systemd.pp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/server/instance/reload.pp b/manifests/server/instance/reload.pp index 53eb5fad99..fd0c750ab2 100644 --- a/manifests/server/instance/reload.pp +++ b/manifests/server/instance/reload.pp @@ -11,6 +11,6 @@ command => $service_reload, onlyif => $service_status, refreshonly => true, - require => Class['postgresql::server::service'], + require => Postgresql::Server::Instance::Service[$name], } } diff --git a/manifests/server/instance/systemd.pp b/manifests/server/instance/systemd.pp index b9a46a2336..9214f2a22a 100644 --- a/manifests/server/instance/systemd.pp +++ b/manifests/server/instance/systemd.pp @@ -32,8 +32,8 @@ extra_systemd_config => $extra_systemd_config, } ), - notify => Class['postgresql::server::service'], - before => Class['postgresql::server::reload'], + notify => Postgresql::Server::Instance::Service[$name], + before => Postgresql::Server::Instance::Reload[$name], } } } From 711b3a1d67c67244c64df2b5fe73efc0dc715741 Mon Sep 17 00:00:00 2001 From: Simon Hoenscheid Date: Wed, 3 Apr 2024 18:10:55 +0200 Subject: [PATCH 17/57] fix service reload/restart for correct instance in server_instance/server::config_entry define --- manifests/server/config_entry.pp | 9 +++++---- manifests/server_instance.pp | 11 ++++++----- spec/classes/server_spec.rb | 2 +- spec/defines/server/config_entry_spec.rb | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/manifests/server/config_entry.pp b/manifests/server/config_entry.pp index d17b844a18..9485b71bcb 100644 --- a/manifests/server/config_entry.pp +++ b/manifests/server/config_entry.pp @@ -12,6 +12,7 @@ Optional[Variant[String[1], Numeric, Array[String[1]]]] $value = undef, Stdlib::Absolutepath $path = $postgresql::server::postgresql_conf_path, Optional[String[1]] $comment = undef, + String[1] $instance_name = 'main', ) { # Those are the variables that are marked as "(change requires restart)" # on postgresql.conf. Items are ordered as on postgresql.conf. @@ -72,15 +73,15 @@ versioncmp($postgresql::server::_version, $requires_restart_until[$key]) < 0 )) { Postgresql_conf { - notify => Class['postgresql::server::reload'], + notify => Postgresql::Server::Instance::Reload[$instance_name], } } elsif $postgresql::server::service_restart_on_change { Postgresql_conf { - notify => Class['postgresql::server::service'], + notify => Postgresql::Server::Instance::Service[$instance_name], } } else { Postgresql_conf { - before => Class['postgresql::server::service'], + before => Postgresql::Server::Instance::Service[$instance_name], } } @@ -90,6 +91,6 @@ key => $key, value => $value, comment => $comment, - require => Class['postgresql::server::initdb'], + require => Postgresql::Server::Instance::Initdb[$instance_name], } } diff --git a/manifests/server_instance.pp b/manifests/server_instance.pp index 9f45b419f2..97814b1908 100644 --- a/manifests/server_instance.pp +++ b/manifests/server_instance.pp @@ -88,11 +88,12 @@ $value = $settings['value'] $comment = $settings['comment'] postgresql::server::config_entry { "${entry}_${$instance_name}": - ensure => bool2str($value =~ Undef, 'absent', 'present'), - key => $entry, - value => $value, - comment => $comment, - path => $config_settings['postgresql_conf_path'], + ensure => bool2str($value =~ Undef, 'absent', 'present'), + key => $entry, + value => $value, + comment => $comment, + path => $config_settings['postgresql_conf_path'], + instance_name => $instance_name, } } $pg_hba_rules.each |String[1] $rule_name, Postgresql::Pg_hba_rule $rule| { diff --git a/spec/classes/server_spec.rb b/spec/classes/server_spec.rb index caf592d611..513c3d1760 100644 --- a/spec/classes/server_spec.rb +++ b/spec/classes/server_spec.rb @@ -129,7 +129,7 @@ class { 'postgresql::globals': it { is_expected.to contain_class('postgresql::server') } it { - expect(subject).to contain_Postgresql_conf('data_directory_for_instance_main').that_notifies('Class[postgresql::server::service]') + expect(subject).to contain_Postgresql_conf('data_directory_for_instance_main').that_notifies('Postgresql::Server::Instance::Service[main]') } it { is_expected.to contain_postgresql__server__config_entry('data_directory_for_instance_main') } diff --git a/spec/defines/server/config_entry_spec.rb b/spec/defines/server/config_entry_spec.rb index 8b13e020bd..243e2ea5e9 100644 --- a/spec/defines/server/config_entry_spec.rb +++ b/spec/defines/server/config_entry_spec.rb @@ -76,7 +76,7 @@ expect(subject).to contain_postgresql_conf('unix_socket_directories') .with(name: 'unix_socket_directories', value: '/var/pgsql, /opt/postgresql, /root/') - .that_notifies('Class[postgresql::server::service]') + .that_notifies('Postgresql::Server::Instance::Service[main]') end end end From 25d42a32bfc139f5007cb0fb6462ab31dffe3a98 Mon Sep 17 00:00:00 2001 From: Simon Hoenscheid Date: Wed, 3 Apr 2024 19:58:52 +0200 Subject: [PATCH 18/57] add parameter documentation --- manifests/server/config_entry.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/server/config_entry.pp b/manifests/server/config_entry.pp index 9485b71bcb..e6460659a2 100644 --- a/manifests/server/config_entry.pp +++ b/manifests/server/config_entry.pp @@ -5,6 +5,7 @@ # @param value Defines the value for the setting. # @param path Path for postgresql.conf # @param comment Defines the comment for the setting. The # is added by default. +# @param instance_name The name of the instance. # define postgresql::server::config_entry ( Enum['present', 'absent'] $ensure = 'present', From 79d8430f648e0dea6b9c2fe0dfec9847b78374a3 Mon Sep 17 00:00:00 2001 From: Simon Hoenscheid Date: Wed, 17 Apr 2024 14:14:57 +0200 Subject: [PATCH 19/57] changing database.pp service dependency --- manifests/server/database.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/server/database.pp b/manifests/server/database.pp index 7d95e76056..48cd44103b 100644 --- a/manifests/server/database.pp +++ b/manifests/server/database.pp @@ -72,7 +72,7 @@ postgresql_psql { "CREATE DATABASE \"${dbname}\"": command => "CREATE DATABASE \"${dbname}\" WITH ${template_option} ${encoding_option} ${locale_option} ${tablespace_option}", unless => "SELECT 1 FROM pg_database WHERE datname = '${dbname}'", - require => Class['postgresql::server::service'], + require => Postgresql::Server::Instance::Service[$instance], } # This will prevent users from connecting to the database unless they've been From e51f3d97fe2a195f9d5e2d52c191d3867bd0b0f1 Mon Sep 17 00:00:00 2001 From: Simon Hoenscheid Date: Wed, 24 Apr 2024 15:41:12 +0200 Subject: [PATCH 20/57] fix service dependency issue --- manifests/server/database_grant.pp | 3 +++ manifests/server/db.pp | 3 +++ manifests/server/table_grant.pp | 3 +++ manifests/server_instance.pp | 11 +++++++---- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/manifests/server/database_grant.pp b/manifests/server/database_grant.pp index 3becf35975..c4a7c67ca1 100644 --- a/manifests/server/database_grant.pp +++ b/manifests/server/database_grant.pp @@ -9,6 +9,7 @@ # @param psql_group Overrides the default postgres user group to be used for related files in the file system. # @param connect_settings Specifies a hash of environment variables used when connecting to a remote server. # @param port Port to use when connecting. +# @param instance The name of the Postgresql database instance. define postgresql::server::database_grant ( Enum['ALL', 'CREATE', 'CONNECT', 'TEMPORARY', 'TEMP', 'all', 'create', 'connect', 'temporary', 'temp'] $privilege, String[1] $db, @@ -19,6 +20,7 @@ Hash $connect_settings = $postgresql::server::default_connect_settings, String[1] $psql_group = $postgresql::server::group, Stdlib::Port $port = $postgresql::server::port, + String[1] $instance = 'main', ) { postgresql::server::grant { "database:${name}": ensure => $ensure, @@ -32,5 +34,6 @@ group => $psql_group, port => $port, connect_settings => $connect_settings, + instance => $instance, } } diff --git a/manifests/server/db.pp b/manifests/server/db.pp index 513e548ed7..9542dcc618 100644 --- a/manifests/server/db.pp +++ b/manifests/server/db.pp @@ -44,6 +44,7 @@ port => $port, user => $psql_user, group => $psql_group, + instance => $instance, } } @@ -54,6 +55,7 @@ psql_user => $psql_user, psql_group => $psql_group, before => Postgresql::Server::Database[$dbname], + instance => $instance, } } @@ -65,6 +67,7 @@ port => $port, psql_user => $psql_user, psql_group => $psql_group, + instance => $instance, } -> Postgresql_conn_validator<| db_name == $dbname |> } diff --git a/manifests/server/table_grant.pp b/manifests/server/table_grant.pp index 9168dd9ce0..719460fd22 100644 --- a/manifests/server/table_grant.pp +++ b/manifests/server/table_grant.pp @@ -12,6 +12,7 @@ # @param psql_user Specifies the OS user for running psql. # @param connect_settings Specifies a hash of environment variables used when connecting to a remote server. # @param onlyif_exists Create grant only if it doesn't exist. +# @param instance The name of the Postgresql database instance. define postgresql::server::table_grant ( Enum['ALL', 'SELECT', 'INSERT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER', 'all', 'select', 'insert', 'update', 'delete', 'truncate', 'references', 'trigger'] $privilege, @@ -24,6 +25,7 @@ Optional[String[1]] $psql_user = undef, Optional[Hash] $connect_settings = undef, Boolean $onlyif_exists = false, + String[1] $instance = 'main', ) { postgresql::server::grant { "table:${name}": ensure => $ensure, @@ -37,5 +39,6 @@ psql_user => $psql_user, onlyif_exists => $onlyif_exists, connect_settings => $connect_settings, + instance => $instance, } } diff --git a/manifests/server_instance.pp b/manifests/server_instance.pp index 97814b1908..5ef8dec527 100644 --- a/manifests/server_instance.pp +++ b/manifests/server_instance.pp @@ -113,10 +113,11 @@ } $databases.each |$database, $database_details| { postgresql::server::database { $database: - * => $database_details, - user => $instance_user, - group => $instance_group, - port => $config_settings['port'], + * => $database_details, + user => $instance_user, + group => $instance_group, + port => $config_settings['port'], + instance => $instance_name, } } $database_grants.each |$db_grant_title, $dbgrants| { @@ -125,6 +126,7 @@ psql_user => $instance_user, psql_group => $instance_group, port => $config_settings['port'], + instance => $instance_name, } } $table_grants.each |$table_grant_title, $tgrants| { @@ -132,6 +134,7 @@ * => $tgrants, psql_user => $instance_user, port => $config_settings['port'], + instance => $instance_name, } } } From dc7011bf90ec55a82f3ee711a474c96f6c5e23dd Mon Sep 17 00:00:00 2001 From: Christoph Maser Date: Sun, 5 May 2024 17:26:12 +0200 Subject: [PATCH 21/57] allow puppet-systemd version 7 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 348ca30e5e..689ab45afc 100644 --- a/metadata.json +++ b/metadata.json @@ -18,7 +18,7 @@ }, { "name": "puppet/systemd", - "version_requirement": ">= 4.0.1 < 7.0.0" + "version_requirement": ">= 4.0.1 < 8.0.0" }, { "name": "puppetlabs/concat", From 822d4f9db587f6ae320441116e2663e558fe9c9e Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 8 May 2024 02:28:22 +0000 Subject: [PATCH 22/57] Release prep v10.3.0 --- CHANGELOG.md | 21 ++++++++++++++++++++- REFERENCE.md | 27 +++++++++++++++++++++++++++ metadata.json | 2 +- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df8d39278e..c0f2ff5598 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [v10.3.0](https://github.com/puppetlabs/puppetlabs-postgresql/tree/v10.3.0) - 2024-05-08 + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v10.2.0...v10.3.0) + +### Added + +- allow puppet-systemd version 7 [#1595](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1595) ([TheMeier](https://github.com/TheMeier)) + +### Fixed + +- Fix instance reload [#1588](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1588) ([SimonHoenscheid](https://github.com/SimonHoenscheid)) + ## [v10.2.0](https://github.com/puppetlabs/puppetlabs-postgresql/tree/v10.2.0) - 2024-04-11 [Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v10.1.0...v10.2.0) @@ -65,6 +77,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v9.2.0...v10.0.0) ### Changed + - postgis: Drop EL5 leftovers and fix package name for Fedora [#1521](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1521) ([bastelfreak](https://github.com/bastelfreak)) - Drop EoL SLES 11.4 code [#1520](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1520) ([bastelfreak](https://github.com/bastelfreak)) - Drop code for Debian without systemd [#1514](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1514) ([bastelfreak](https://github.com/bastelfreak)) @@ -165,6 +178,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v8.3.0...v9.0.0) ### Changed + - (CONT-792) - Add Puppet 8/Drop Puppet 6 [#1414](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1414) ([jordanbreen28](https://github.com/jordanbreen28)) ## [v8.3.0](https://github.com/puppetlabs/puppetlabs-postgresql/tree/v8.3.0) - 2023-04-21 @@ -244,6 +258,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v7.5.0...v8.0.0) ### Changed + - Support setting default_privileges on all schemas [#1298](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1298) ([fish-face](https://github.com/fish-face)) ### Added @@ -251,7 +266,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a - add default version for Fedora 35 [#1317](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1317) ([jflorian](https://github.com/jflorian)) - add scram-sha-256 support [#1313](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1313) ([fe80](https://github.com/fe80)) - add support for Ubuntu Hirsute and Impish [#1312](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1312) ([nicholascioli](https://github.com/nicholascioli)) -- Allow systemd to mask postgresql service file [#1310](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1310) ([kim-sondrup](https://github.com/kim-sondrup)) +- Allow systemd to mask postgresql service file [#1310](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1310) ([kimsondrup](https://github.com/kimsondrup)) - Make ::contrib a noop on OSes without a contrib package [#1309](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1309) ([carlosduelo](https://github.com/carlosduelo)) - pdksync - (IAC-1753) - Add Support for AlmaLinux 8 [#1308](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1308) ([david22swan](https://github.com/david22swan)) - MODULES-11201: add service_name for Ubuntu 18.04 and later [#1306](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1306) ([moritz-makandra](https://github.com/moritz-makandra)) @@ -354,6 +369,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v6.10.2...v7.0.0) ### Changed + - pdksync - (MAINT) Remove SLES 11 support [#1247](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1247) ([sanfrancrisko](https://github.com/sanfrancrisko)) - pdksync - (MAINT) Remove RHEL 5 family support [#1246](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1246) ([sanfrancrisko](https://github.com/sanfrancrisko)) - pdksync - Remove Puppet 5 from testing and bump minimal version to 6.0.0 [#1238](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1238) ([carabasdaniel](https://github.com/carabasdaniel)) @@ -520,6 +536,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/5.12.1...v6.0.0) ### Changed + - pdksync - (MODULES-8444) - Raise lower Puppet bound [#1070](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1070) ([david22swan](https://github.com/david22swan)) - (maint) remove inconsistent extra variable [#1044](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1044) ([binford2k](https://github.com/binford2k)) @@ -618,6 +635,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/5.4.0...5.5.0) ### Changed + - Fix creation of recovery.conf file when recovery configuration is not specified [#995](https://github.com/puppetlabs/puppetlabs-postgresql/pull/995) ([cdloh](https://github.com/cdloh)) ### Added @@ -703,6 +721,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/4.9.0...5.0.0) ### Changed + - Unset default log_line_prefix [#870](https://github.com/puppetlabs/puppetlabs-postgresql/pull/870) ([hasegeli](https://github.com/hasegeli)) - Let listen_addresses be defined independently [#865](https://github.com/puppetlabs/puppetlabs-postgresql/pull/865) ([hasegeli](https://github.com/hasegeli)) diff --git a/REFERENCE.md b/REFERENCE.md index 64fd7e14b9..247b58c952 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1546,6 +1546,7 @@ The following parameters are available in the `postgresql::server::config_entry` * [`value`](#-postgresql--server--config_entry--value) * [`path`](#-postgresql--server--config_entry--path) * [`comment`](#-postgresql--server--config_entry--comment) +* [`instance_name`](#-postgresql--server--config_entry--instance_name) ##### `ensure` @@ -1587,6 +1588,14 @@ Defines the comment for the setting. The # is added by default. Default value: `undef` +##### `instance_name` + +Data type: `String[1]` + +The name of the instance. + +Default value: `'main'` + ### `postgresql::server::database` Define for creating a database. @@ -1748,6 +1757,7 @@ The following parameters are available in the `postgresql::server::database_gran * [`psql_group`](#-postgresql--server--database_grant--psql_group) * [`connect_settings`](#-postgresql--server--database_grant--connect_settings) * [`port`](#-postgresql--server--database_grant--port) +* [`instance`](#-postgresql--server--database_grant--instance) ##### `privilege` @@ -1815,6 +1825,14 @@ Port to use when connecting. Default value: `$postgresql::server::port` +##### `instance` + +Data type: `String[1]` + +The name of the Postgresql database instance. + +Default value: `'main'` + ### `postgresql::server::db` Define for conveniently creating a role, database and assigning the correct permissions. @@ -3970,6 +3988,7 @@ The following parameters are available in the `postgresql::server::table_grant` * [`psql_user`](#-postgresql--server--table_grant--psql_user) * [`connect_settings`](#-postgresql--server--table_grant--connect_settings) * [`onlyif_exists`](#-postgresql--server--table_grant--onlyif_exists) +* [`instance`](#-postgresql--server--table_grant--instance) ##### `privilege` @@ -4049,6 +4068,14 @@ Create grant only if it doesn't exist. Default value: `false` +##### `instance` + +Data type: `String[1]` + +The name of the Postgresql database instance. + +Default value: `'main'` + ### `postgresql::server::tablespace` This module creates tablespace. diff --git a/metadata.json b/metadata.json index 689ab45afc..c5b9d1cb21 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-postgresql", - "version": "10.2.0", + "version": "10.3.0", "author": "puppetlabs", "summary": "Offers support for basic management of PostgreSQL databases.", "license": "Apache-2.0", From de9e9d744ab0a7d7a235691a27e127510f1ed073 Mon Sep 17 00:00:00 2001 From: Malik Parvez <84777619+malikparvez@users.noreply.github.com> Date: Tue, 21 May 2024 21:19:17 +0530 Subject: [PATCH 23/57] ITHELP-87329 : replace pull_request_target with pull_request --- .github/workflows/mend.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/mend.yml b/.github/workflows/mend.yml index 8b5b401847..b4100a5af0 100644 --- a/.github/workflows/mend.yml +++ b/.github/workflows/mend.yml @@ -1,10 +1,9 @@ name: "mend" on: - pull_request_target: - types: - - opened - - synchronize + pull_request: + branches: + - "main" schedule: - cron: "0 0 * * *" workflow_dispatch: From 6cbbd29d99e26c417c761e0d246d161e438da093 Mon Sep 17 00:00:00 2001 From: Malik Parvez <84777619+malikparvez@users.noreply.github.com> Date: Tue, 4 Jun 2024 13:56:05 +0530 Subject: [PATCH 24/57] ITHELP-87329 : replace pull_request_target with pull_request --- .github/workflows/labeller.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/labeller.yml b/.github/workflows/labeller.yml index ee149bf525..0d4870d70b 100644 --- a/.github/workflows/labeller.yml +++ b/.github/workflows/labeller.yml @@ -6,7 +6,7 @@ on: - opened - labeled - unlabeled - pull_request_target: + pull_request: types: - opened - labeled From 1a5ad40561664cfeb7bb61140b5aee9197fe0d87 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Thu, 30 May 2024 17:34:03 +0200 Subject: [PATCH 25/57] Fix spelling of PostgreSQL in a debug statement --- lib/puppet/provider/postgresql_conf/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/provider/postgresql_conf/ruby.rb b/lib/puppet/provider/postgresql_conf/ruby.rb index 7e5db35232..d3474a8bff 100644 --- a/lib/puppet/provider/postgresql_conf/ruby.rb +++ b/lib/puppet/provider/postgresql_conf/ruby.rb @@ -36,7 +36,7 @@ def parse_config active_settings.push(attributes_hash) end end - Puppet.debug("DEBUG: parse_config Active Settings found in Postgreql config file: #{active_settings}") + Puppet.debug("DEBUG: parse_config Active Settings found in PostgreSQL config file: #{active_settings}") active_settings end From 9c5e5cec05a6a11396dda816580d86e8bc940636 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Thu, 30 May 2024 17:41:31 +0200 Subject: [PATCH 26/57] Avoid opening the file in postgresql_conf Using File.open without closing it can leak file descriptors. It's actually not needed at all because File.foreach, File.readlines and File.write all accept a filename. This simplifies the code in the process. --- lib/puppet/provider/postgresql_conf/ruby.rb | 29 ++++++++------------- 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/lib/puppet/provider/postgresql_conf/ruby.rb b/lib/puppet/provider/postgresql_conf/ruby.rb index d3474a8bff..3719eb635e 100644 --- a/lib/puppet/provider/postgresql_conf/ruby.rb +++ b/lib/puppet/provider/postgresql_conf/ruby.rb @@ -13,15 +13,13 @@ # The function parses the postgresql.conf and figures out which active settings exist in a config file and returns an array of hashes # def parse_config - # open the config file - file = File.open(resource[:target]) # regex to match active keys, values and comments active_values_regex = %r{^\s*(?[\w.]+)\s*=?\s*(?.*?)(?:\s*#\s*(?.*))?\s*$} # empty array to be filled with hashes active_settings = [] # iterate the file and construct a hash for every matching/active setting # the hash is pushed to the array and the array is returned - File.foreach(file).with_index do |line, index| + File.foreach(resource[:target]).with_index do |line, index| line_number = index + 1 matches = line.match(active_values_regex) if matches @@ -63,12 +61,11 @@ def add_header(lines) # This function writes the config file, it removes the old header, adds a new one and writes the file # - # @param [File] the file object of the postgresql configuration file # @param [Array] lines of the parsed postgresql configuration file - def write_config(file, lines) + def write_config(lines) lines = delete_header(lines) lines = add_header(lines) - File.write(file, lines.join) + File.write(resource[:target], lines.join) end # check, if resource exists in postgresql.conf file @@ -85,23 +82,21 @@ def exists? # remove resource if exists and is set to absent def destroy entry_regex = %r{#{resource[:key]}.*=.*#{resource[:value]}} - file = File.open(resource[:target]) - lines = File.readlines(file) + lines = File.readlines(resource[:target]) lines.delete_if do |entry| entry.match?(entry_regex) end - write_config(file, lines) + write_config(lines) end # create resource if it does not exists def create - file = File.open(resource[:target]) - lines = File.readlines(file) + lines = File.readlines(resource[:target]) new_line = line(key: resource[:key], value: resource[:value], comment: resource[:comment]) lines.push(new_line) - write_config(file, lines) + write_config(lines) end # getter - get value of a resource @@ -116,8 +111,7 @@ def comment # setter - set value of a resource def value=(_value) - file = File.open(resource[:target]) - lines = File.readlines(file) + lines = File.readlines(resource[:target]) active_values_regex = %r{^\s*(?[\w.]+)\s*=?\s*(?.*?)(?:\s*#\s*(?.*))?\s*$} new_line = line(key: resource[:key], value: resource[:value], comment: resource[:comment]) @@ -125,13 +119,12 @@ def value=(_value) matches = line.to_s.match(active_values_regex) lines[index] = new_line if matches && (matches[:key] == resource[:key] && matches[:value] != resource[:value]) end - write_config(file, lines) + write_config(lines) end # setter - set comment of a resource def comment=(_comment) - file = File.open(resource[:target]) - lines = File.readlines(file) + lines = File.readlines(resource[:target]) active_values_regex = %r{^\s*(?[\w.]+)\s*=?\s*(?.*?)(?:\s*#\s*(?.*))?\s*$} new_line = line(key: resource[:key], value: resource[:value], comment: resource[:comment]) @@ -139,7 +132,7 @@ def comment=(_comment) matches = line.to_s.match(active_values_regex) lines[index] = new_line if matches && (matches[:key] == resource[:key] && matches[:comment] != resource[:comment]) end - write_config(file, lines) + write_config(lines) end private From f2b193dd6ff7a0e0375a3ffaa610cd0727620219 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Thu, 30 May 2024 17:43:15 +0200 Subject: [PATCH 27/57] Pass an offset to with_index to calculate line numbers Rather than starting from 0 and always adding 1, this tells with_index to start at 1. --- lib/puppet/provider/postgresql_conf/ruby.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/puppet/provider/postgresql_conf/ruby.rb b/lib/puppet/provider/postgresql_conf/ruby.rb index 3719eb635e..f21caf2b5c 100644 --- a/lib/puppet/provider/postgresql_conf/ruby.rb +++ b/lib/puppet/provider/postgresql_conf/ruby.rb @@ -19,8 +19,7 @@ def parse_config active_settings = [] # iterate the file and construct a hash for every matching/active setting # the hash is pushed to the array and the array is returned - File.foreach(resource[:target]).with_index do |line, index| - line_number = index + 1 + File.foreach(resource[:target]).with_index(1) do |line, line_number| matches = line.match(active_values_regex) if matches value = if matches[:value].to_i.to_s == matches[:value] From 35283af25e0571a69380b42f4f23daffd2abcca2 Mon Sep 17 00:00:00 2001 From: rajat-puppet Date: Mon, 22 Jul 2024 17:31:20 +0530 Subject: [PATCH 28/57] Remove labeller.yml --- .github/workflows/labeller.yml | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .github/workflows/labeller.yml diff --git a/.github/workflows/labeller.yml b/.github/workflows/labeller.yml deleted file mode 100644 index 0d4870d70b..0000000000 --- a/.github/workflows/labeller.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Labeller - -on: - issues: - types: - - opened - - labeled - - unlabeled - pull_request: - types: - - opened - - labeled - - unlabeled - -jobs: - label: - runs-on: ubuntu-latest - steps: - - - uses: puppetlabs/community-labeller@v1.0.1 - name: Label issues or pull requests - with: - label_name: community - label_color: '5319e7' - org_membership: puppetlabs - fail_if_member: 'true' - token: ${{ secrets.IAC_COMMUNITY_LABELER }} From 2fab228c87336e7915802c9b27cfd31f486d4c69 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 10 Apr 2024 13:50:30 +0200 Subject: [PATCH 29/57] Add EL9 support --- metadata.json | 12 ++++++++---- spec/acceptance/server_instance_spec.rb | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/metadata.json b/metadata.json index c5b9d1cb21..25d4509af6 100644 --- a/metadata.json +++ b/metadata.json @@ -38,13 +38,15 @@ "operatingsystem": "CentOS", "operatingsystemrelease": [ "7", - "8" + "8", + "9" ] }, { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ - "7" + "7", + "9" ] }, { @@ -79,13 +81,15 @@ { "operatingsystem": "Rocky", "operatingsystemrelease": [ - "8" + "8", + "9" ] }, { "operatingsystem": "AlmaLinux", "operatingsystemrelease": [ - "8" + "8", + "9" ] } ], diff --git a/spec/acceptance/server_instance_spec.rb b/spec/acceptance/server_instance_spec.rb index d00ce95f83..4b8d6a4bb8 100644 --- a/spec/acceptance/server_instance_spec.rb +++ b/spec/acceptance/server_instance_spec.rb @@ -3,7 +3,7 @@ # run a test task require 'spec_helper_acceptance' -describe 'postgresql instance test1', if: os[:family] == 'redhat' && os[:release].start_with?('8') do +describe 'postgresql instance test1', if: os[:family] == 'redhat' && !os[:release].start_with?('7') do pp = <<-MANIFEST # set global defaults class { 'postgresql::globals': @@ -12,7 +12,7 @@ class { 'postgresql::globals': manage_package_repo => false, manage_dnf_module => true, needs_initdb => true, - version => '13', + version => '16', } # stop default main instance class { 'postgresql::server': From 7cc99852c19d12d8108997b5e599c8e35b32aa4d Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 31 Jul 2024 14:39:26 +0200 Subject: [PATCH 30/57] Fix typo in README: instaces -> instances --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c7189eb025..1ed5f1e1f0 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ creating a new instance has the following advantages: * main instance can be disabled -Here is a profile which can be used to create instaces +Here is a profile which can be used to create instances ```puppet class profiles::postgres ( From 79f9a85e05a4a7bd13c9ac140e24424667464fbb Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 28 Aug 2024 15:52:27 +0200 Subject: [PATCH 31/57] Fix typos and casing in README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1ed5f1e1f0..5963b85bf6 100644 --- a/README.md +++ b/README.md @@ -78,10 +78,10 @@ For more details about server configuration parameters, consult the [PostgreSQL This module supports managing multiple instances (the default instance is referred to as 'main' and managed via including the server.pp class) -**NOTE:** This feature is currently tested on Centos 8 Streams/RHEL8 with DNF Modules enabled. Different Linux plattforms and/or the Postgresql.org -packages distribute different Systemd service files or use wrapper scripts with Systemd to start Postgres. Additional adjustmentments are needed to get this working on these plattforms. +**NOTE:** This feature is currently tested on CentOS 8 Streams/RHEL8 with DNF Modules enabled. Different Linux platforms and/or the postgresql.org +packages distribute different systemd service files or use wrapper scripts with systemd to start PostgreSQL. Additional adjustmentments are needed to get this working on these platforms. -#### Working Plattforms +#### Working Platforms * Centos 8 Streams * RHEL 8 From 231e00815c15939768b70da8425e7f81d13d6ba9 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 28 Aug 2024 15:53:09 +0200 Subject: [PATCH 32/57] Document how to select a version as its own chapter This documents the various ways to set up repositories as well. --- README.md | 48 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 5963b85bf6..8f7141dbb3 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,42 @@ If you get an error message from these commands, your permission settings restri For more details about server configuration parameters, consult the [PostgreSQL Runtime Configuration documentation](http://www.postgresql.org/docs/current/static/runtime-config.html). +#### Selecting a version + +The version is intended to be supplied via `postgresql::globals`. +By default the module tries to derive the version based on the OS facts, but can be overridden. +This is typically used with the official postgresql.org packages: + +```puppet +class { 'postgresql::globals': + manage_package_repo => true, + version => '16', +} + +include postgresql::server +``` + +On EL 8 & 9 you can also use DNF modules: + +```puppet +class { 'postgresql::globals': + manage_dnf_module => true, + version => '16', +} + +include postgresql::server +``` + +If you manage the repositories yourself, overriding the version is sufficient. + +```puppet +class { 'postgresql::globals': + version => '16', +} + +include postgresql::server +``` + ### Configure an instance This module supports managing multiple instances (the default instance is referred to as 'main' and managed via including the server.pp class) @@ -341,18 +377,6 @@ class { 'postgresql::server': } ``` -To use a specific version of the PostgreSQL package: - -```puppet -class { 'postgresql::globals': - manage_package_repo => true, - version => '9.2', -} - -class { 'postgresql::server': -} -``` - ### Manage remote users, roles, and permissions Remote SQL objects are managed using the same Puppet resources as local SQL objects, along with a `$connect_settings` hash. This provides control over how Puppet connects to the remote Postgres instances and which version is used for generating SQL commands. From 831070812bcd7ba46e699d3dadb82440ab11ac9d Mon Sep 17 00:00:00 2001 From: Shubham Shinde Date: Fri, 4 Oct 2024 10:41:31 +0530 Subject: [PATCH 33/57] (CAT-2052) Bump SLES-15 package/product versions - sles-legacy 15.5 version is no longer available in the default repos. Use the os.distro.release.full fact so that we don't have to bump the manually in the future. - Bump postgresql-server version from 14 to 16 since 14 is no longer available in the default repos. --- manifests/globals.pp | 2 +- spec/spec_helper_acceptance_local.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/globals.pp b/manifests/globals.pp index 99dce13966..b4a7bc290f 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -236,7 +236,7 @@ /12\.0/ => '93', /12\.[1-3]/ => '94', /12\.[4-5]/ => '12', - /15\.[0-9]/ => '14', + /15\.[0-9]/ => '16', default => '96', }, 'OpenSuSE' => $facts['os']['release']['full'] ? { diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb index ebe3da6556..669741c6c1 100644 --- a/spec/spec_helper_acceptance_local.rb +++ b/spec/spec_helper_acceptance_local.rb @@ -46,8 +46,8 @@ def install_dependencies if $facts['os']['family'] in ['SLES', 'SUSE'] { exec { 'Enable legacy repos': path => '/bin:/usr/bin/:/sbin:/usr/sbin', - command => 'SUSEConnect --product sle-module-legacy/15.5/x86_64', - unless => 'SUSEConnect --status-text | grep sle-module-legacy/15.5/x86_64', + command => "SUSEConnect --product sle-module-legacy/${$facts['os']['distro']['release']['full']}/x86_64", + unless => "SUSEConnect --status-text | grep sle-module-legacy/${$facts['os']['distro']['release']['full']}/x86_64", } package { 'net-tools-deprecated': From 0fb0f3073c1cbb91eb5a6b372a9ecaba019603f8 Mon Sep 17 00:00:00 2001 From: skyamgarp <130442619+skyamgarp@users.noreply.github.com> Date: Wed, 6 Nov 2024 12:37:49 +0530 Subject: [PATCH 34/57] (CAT-2124) Add support for Ubuntu 24 --- metadata.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 25d4509af6..df225a9c04 100644 --- a/metadata.json +++ b/metadata.json @@ -75,7 +75,8 @@ "operatingsystemrelease": [ "18.04", "20.04", - "22.04" + "22.04", + "24.04" ] }, { From f4bcc9627a533384a43b0459aa739b60b3be7451 Mon Sep 17 00:00:00 2001 From: Amit Karsale Date: Wed, 6 Nov 2024 18:59:26 +0530 Subject: [PATCH 35/57] pdksync - (PF-3525) - pdk update for module --- .gitignore | 7 +++++++ .pdkignore | 7 +++++++ .rubocop.yml | 2 +- Gemfile | 13 ++++++------- metadata.json | 4 ++-- spec/spec_helper.rb | 5 +++-- 6 files changed, 26 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 3f1551212b..2803e566b5 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ /spec/fixtures/modules/* /tmp/ /vendor/ +/.vendor/ /convert_report.txt /update_report.txt .DS_Store @@ -26,3 +27,9 @@ .envrc /inventory.yaml /spec/fixtures/litmus_inventory.yaml +.resource_types +.modules +.task_cache.json +.plan_cache.json +.rerun.json +bolt-debug.log diff --git a/.pdkignore b/.pdkignore index 862847a72c..84684be63f 100644 --- a/.pdkignore +++ b/.pdkignore @@ -19,6 +19,7 @@ /spec/fixtures/modules/* /tmp/ /vendor/ +/.vendor/ /convert_report.txt /update_report.txt .DS_Store @@ -26,6 +27,12 @@ .envrc /inventory.yaml /spec/fixtures/litmus_inventory.yaml +.resource_types +.modules +.task_cache.json +.plan_cache.json +.rerun.json +bolt-debug.log /.fixtures.yml /Gemfile /.gitattributes diff --git a/.rubocop.yml b/.rubocop.yml index e6bd5af841..439ea84ee8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,7 +5,7 @@ require: AllCops: NewCops: enable DisplayCopNames: true - TargetRubyVersion: '2.7' + TargetRubyVersion: '2.6' Include: - "**/*.rb" Exclude: diff --git a/Gemfile b/Gemfile index 151435e2c1..7a1566ddb4 100644 --- a/Gemfile +++ b/Gemfile @@ -20,10 +20,10 @@ group :development do gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "deep_merge", '~> 1.2.2', require: false gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false - gem "facterdb", '~> 1.18', require: false + gem "facterdb", '~> 1.18', require: false gem "metadata-json-lint", '~> 4.0', require: false - gem "puppetlabs_spec_helper", '~> 6.0', require: false gem "rspec-puppet-facts", '~> 2.0', require: false gem "dependency_checker", '~> 1.0.0', require: false gem "parallel_tests", '= 3.12.1', require: false @@ -33,19 +33,18 @@ group :development do gem "rubocop", '~> 1.50.0', require: false gem "rubocop-performance", '= 1.16.0', require: false gem "rubocop-rspec", '= 2.19.0', require: false - gem "puppet-strings", '~> 4.0', require: false gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "github_changelog_generator", '= 1.15.2', require: false end +group :development, :release_prep do + gem "puppet-strings", '~> 4.0', require: false + gem "puppetlabs_spec_helper", '~> 7.0', require: false +end group :system_tests do gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] gem "CFPropertyList", '< 3.0.7', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "serverspec", '~> 2.41', require: false end -group :release_prep do - gem "puppet-strings", '~> 4.0', require: false - gem "puppetlabs_spec_helper", '~> 6.0', require: false -end puppet_version = ENV['PUPPET_GEM_VERSION'] facter_version = ENV['FACTER_GEM_VERSION'] diff --git a/metadata.json b/metadata.json index df225a9c04..d4acf80391 100644 --- a/metadata.json +++ b/metadata.json @@ -100,7 +100,7 @@ "version_requirement": ">= 7.0.0 < 9.0.0" } ], - "pdk-version": "3.0.0", + "pdk-version": "3.2.0", "template-url": "https://github.com/puppetlabs/pdk-templates#main", - "template-ref": "heads/main-0-g4fb29e7" + "template-ref": "tags/3.2.0.4-0-g5d17ec1" } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6820cebee7..ae7c1f6818 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -25,7 +25,8 @@ next unless File.exist?(f) && File.readable?(f) && File.size?(f) begin - default_facts.merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true)) + require 'deep_merge' + default_facts.deep_merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true)) rescue StandardError => e RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" end @@ -33,7 +34,7 @@ # read default_facts and merge them over what is provided by facterdb default_facts.each do |fact, value| - add_custom_fact fact, value + add_custom_fact fact, value, merge_facts: true end RSpec.configure do |c| From 076d76cb55650433c2cafc99d15d033b5750c951 Mon Sep 17 00:00:00 2001 From: Lucien Weller Date: Mon, 25 Nov 2024 07:34:16 +0100 Subject: [PATCH 36/57] added default version for fedora 40 and 41 --- manifests/globals.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/globals.pp b/manifests/globals.pp index b4a7bc290f..64a4815fcc 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -180,6 +180,7 @@ $default_version = $facts['os']['family'] ? { /^(RedHat|Linux)/ => $facts['os']['name'] ? { 'Fedora' => $facts['os']['release']['major'] ? { + /^(40|41)$/ => '16', /^(38|39)$/ => '15', /^(36|37)$/ => '14', /^(34|35)$/ => '13', From 553fc733ac4da65d391a02348aa90bce614377b6 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 25 Nov 2024 17:07:36 +0000 Subject: [PATCH 37/57] Release prep v10.4.0 --- CHANGELOG.md | 21 ++++++++++++++++++++- metadata.json | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0f2ff5598..bb14a1289c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [v10.4.0](https://github.com/puppetlabs/puppetlabs-postgresql/tree/v10.4.0) - 2024-11-25 + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v10.3.0...v10.4.0) + +### Added + +- added default version for fedora 40 and 41 [#1621](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1621) ([lweller](https://github.com/lweller)) +- (CAT-2124) Add support for Ubuntu 24 [#1619](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1619) ([skyamgarp](https://github.com/skyamgarp)) +- Add EL9 support [#1591](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1591) ([bastelfreak](https://github.com/bastelfreak)) + +### Fixed + +- Avoid opening the file in postgresql_conf [#1599](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1599) ([ekohl](https://github.com/ekohl)) + +### Other + +- Document how to select a version as its own chapter [#1610](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1610) ([ekohl](https://github.com/ekohl)) +- Fix typo in README: instaces -> instances [#1607](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1607) ([ekohl](https://github.com/ekohl)) + ## [v10.3.0](https://github.com/puppetlabs/puppetlabs-postgresql/tree/v10.3.0) - 2024-05-08 [Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v10.2.0...v10.3.0) @@ -267,7 +286,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a - add scram-sha-256 support [#1313](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1313) ([fe80](https://github.com/fe80)) - add support for Ubuntu Hirsute and Impish [#1312](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1312) ([nicholascioli](https://github.com/nicholascioli)) - Allow systemd to mask postgresql service file [#1310](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1310) ([kimsondrup](https://github.com/kimsondrup)) -- Make ::contrib a noop on OSes without a contrib package [#1309](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1309) ([carlosduelo](https://github.com/carlosduelo)) +- Make ::contrib a noop on OSes without a contrib package [#1309](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1309) ([cduelo](https://github.com/cduelo)) - pdksync - (IAC-1753) - Add Support for AlmaLinux 8 [#1308](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1308) ([david22swan](https://github.com/david22swan)) - MODULES-11201: add service_name for Ubuntu 18.04 and later [#1306](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1306) ([moritz-makandra](https://github.com/moritz-makandra)) - pdksync - (IAC-1751) - Add Support for Rocky 8 [#1305](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1305) ([david22swan](https://github.com/david22swan)) diff --git a/metadata.json b/metadata.json index d4acf80391..82f3c97482 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-postgresql", - "version": "10.3.0", + "version": "10.4.0", "author": "puppetlabs", "summary": "Offers support for basic management of PostgreSQL databases.", "license": "Apache-2.0", From ed8e752a0aee28285ee4273e0173be8025a8af2b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 3 Jan 2024 12:05:14 -1000 Subject: [PATCH 38/57] [PATCH] reenable acceptance test for server encoding --- spec/acceptance/utf8_encoding_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/acceptance/utf8_encoding_spec.rb b/spec/acceptance/utf8_encoding_spec.rb index b816842138..a7c9b52497 100644 --- a/spec/acceptance/utf8_encoding_spec.rb +++ b/spec/acceptance/utf8_encoding_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper_acceptance' -describe 'postgresql::server', skip: 'IAC-1286' do +describe 'postgresql::server' do let(:pp) do <<-MANIFEST class { 'postgresql::globals': From 9f589ffd175ad416a314917136002bf81796bb8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Wed, 3 Jan 2024 12:06:16 -1000 Subject: [PATCH 39/57] Fix anchoring in `postgresql::server::plperl` When using anchors, resources should be sandwiched those. An ordering relation was missing for the "end" anchor. --- manifests/server/plperl.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/server/plperl.pp b/manifests/server/plperl.pp index 1db5d4aa8f..08c5298fc3 100644 --- a/manifests/server/plperl.pp +++ b/manifests/server/plperl.pp @@ -16,5 +16,5 @@ -> Class['postgresql::server::install'] -> Package['postgresql-plperl'] -> Class['postgresql::server::service'] - anchor { 'postgresql::server::plperl::end': } + -> anchor { 'postgresql::server::plperl::end': } } From f562902defda5afe8c121280c1b3fdd232ba3fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Wed, 3 Jan 2024 12:10:08 -1000 Subject: [PATCH 40/57] Fix anchoring in `postgresql::server::instance::service` Some resources where not properly ordered between the "begin" and "end" anchors. Make sure they are properly bound to them. --- manifests/server/instance/service.pp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/manifests/server/instance/service.pp b/manifests/server/instance/service.pp index f778518dc0..47e7ecda25 100644 --- a/manifests/server/instance/service.pp +++ b/manifests/server/instance/service.pp @@ -42,6 +42,10 @@ status => $service_status, } + Anchor["postgresql::server::service::begin::${name}"] + -> Service["postgresqld_instance_${name}"] + -> Anchor["postgresql::server::service::end::${name}"] + if $service_ensure in ['running', true] { # This blocks the class before continuing if chained correctly, making # sure the service really is 'up' before continuing. @@ -56,10 +60,13 @@ sleep => 1, tries => 60, psql_path => $psql_path, - require => Service["postgresqld_instance_${name}"], - before => Anchor["postgresql::server::service::end::${name}"], } - Postgresql::Server::Database <| title == $default_database |> -> Postgresql_conn_validator["validate_service_is_running_instance_${name}"] + + Anchor["postgresql::server::service::begin::${name}"] + -> Service["postgresqld_instance_${name}"] + -> Postgresql::Server::Database <| title == $default_database |> + -> Postgresql_conn_validator["validate_service_is_running_instance_${name}"] + -> Anchor["postgresql::server::service::end::${name}"] } } From 62c5fc5b0cf07bf3aecd0e62e9ce479d7201c173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Wed, 3 Jan 2024 12:19:55 -1000 Subject: [PATCH 41/57] Fix `postgresql_psql` autorequire It does not really make sense to require the "begin" anchor, the `postgresql_psql` type communicating with the server, it makes more sense to require the "end" anchor which mean that the server is running and reachable. --- lib/puppet/type/postgresql_psql.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/type/postgresql_psql.rb b/lib/puppet/type/postgresql_psql.rb index 021753e7ab..3b4a1c8353 100644 --- a/lib/puppet/type/postgresql_psql.rb +++ b/lib/puppet/type/postgresql_psql.rb @@ -135,7 +135,7 @@ def matches(value) end autorequire(:anchor) do - ["postgresql::server::service::begin::#{self[:instance]}"] + ["postgresql::server::service::end::#{self[:instance]}"] end autorequire(:service) do From cd67d139337851af33a817d3b724f98691f0cbb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Wed, 3 Jan 2024 13:05:46 -1000 Subject: [PATCH 42/57] Remove redundant autorequire We already have a relationship in `manifests/server/instance/service.pp` that ensure `Service["postgresqld_instance_${name}"]` is realized before `Anchor["postgresql::server::service::end::${name}"]`. Fun fact, removing this duplaciate fix the circular dependency reported by puppet. --- lib/puppet/type/postgresql_psql.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/puppet/type/postgresql_psql.rb b/lib/puppet/type/postgresql_psql.rb index 3b4a1c8353..d0101857c0 100644 --- a/lib/puppet/type/postgresql_psql.rb +++ b/lib/puppet/type/postgresql_psql.rb @@ -138,10 +138,6 @@ def matches(value) ["postgresql::server::service::end::#{self[:instance]}"] end - autorequire(:service) do - ["postgresqld_instance_#{self[:instance]}"] - end - def should_run_sql(refreshing = false) onlyif_param = @parameters[:onlyif] unless_param = @parameters[:unless] From 256971d469eb34e04e868ff4c09669de7638a0d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Wed, 17 Apr 2024 15:37:15 -1000 Subject: [PATCH 43/57] DELETE ME ss(8) report the same for a working and non-working port as far as serverspec is concerned. Maybe ordering has an impact? We know these tests fail when running at the end of the test suite, so attempt to run them earlier. --- spec/acceptance/{utf8_encoding_spec.rb => aaa_spec.rb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename spec/acceptance/{utf8_encoding_spec.rb => aaa_spec.rb} (100%) diff --git a/spec/acceptance/utf8_encoding_spec.rb b/spec/acceptance/aaa_spec.rb similarity index 100% rename from spec/acceptance/utf8_encoding_spec.rb rename to spec/acceptance/aaa_spec.rb From d44c0d648ccaf681e9475b26e086cc6b42c1ad68 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Tue, 7 Jan 2025 09:55:48 +0100 Subject: [PATCH 44/57] puppetlabs/apt: allow 10.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 82f3c97482..9c0589b726 100644 --- a/metadata.json +++ b/metadata.json @@ -14,7 +14,7 @@ }, { "name": "puppetlabs/apt", - "version_requirement": ">= 9.2.0 < 10.0.0" + "version_requirement": ">= 9.2.0 < 11.0.0" }, { "name": "puppet/systemd", From 0ce9c517b2a92bd9824945e800cc204721ba6ef1 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Tue, 7 Jan 2025 09:56:48 +0100 Subject: [PATCH 45/57] puppet/systemd: allow 8.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 82f3c97482..05578913c0 100644 --- a/metadata.json +++ b/metadata.json @@ -18,7 +18,7 @@ }, { "name": "puppet/systemd", - "version_requirement": ">= 4.0.1 < 8.0.0" + "version_requirement": ">= 4.0.1 < 9.0.0" }, { "name": "puppetlabs/concat", From 8e17d7525d13e44d0fe7d305b4f7486102add97c Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Tue, 7 Jan 2025 09:55:48 +0100 Subject: [PATCH 46/57] puppetlabs/apt: allow 10.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 05578913c0..106e4677a9 100644 --- a/metadata.json +++ b/metadata.json @@ -14,7 +14,7 @@ }, { "name": "puppetlabs/apt", - "version_requirement": ">= 9.2.0 < 10.0.0" + "version_requirement": ">= 9.2.0 < 11.0.0" }, { "name": "puppet/systemd", From 3f301f3d3e11f10fc3c2bb9bcd034e22a6d1a160 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Tue, 7 Jan 2025 09:56:48 +0100 Subject: [PATCH 47/57] puppet/systemd: allow 8.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 9c0589b726..106e4677a9 100644 --- a/metadata.json +++ b/metadata.json @@ -18,7 +18,7 @@ }, { "name": "puppet/systemd", - "version_requirement": ">= 4.0.1 < 8.0.0" + "version_requirement": ">= 4.0.1 < 9.0.0" }, { "name": "puppetlabs/concat", From 5c9c61f913643cd479d05ff239a7e83d480c899c Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 7 Jan 2025 10:25:32 +0000 Subject: [PATCH 48/57] Release prep v10.5.0 --- CHANGELOG.md | 11 ++++++++++- metadata.json | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb14a1289c..e28d5a2f94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). -## [v10.4.0](https://github.com/puppetlabs/puppetlabs-postgresql/tree/v10.4.0) - 2024-11-25 +## [v10.5.0](https://github.com/puppetlabs/puppetlabs-postgresql/tree/v10.5.0) - 2025-01-07 + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v10.4.0...v10.5.0) + +### Added + +- puppet/systemd: allow 8.x [#1627](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1627) ([evgeni](https://github.com/evgeni)) +- puppetlabs/apt: allow 10.x [#1626](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1626) ([evgeni](https://github.com/evgeni)) + +## [v10.4.0](https://github.com/puppetlabs/puppetlabs-postgresql/tree/v10.4.0) - 2024-12-16 [Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v10.3.0...v10.4.0) diff --git a/metadata.json b/metadata.json index 106e4677a9..6ad73624ec 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-postgresql", - "version": "10.4.0", + "version": "10.5.0", "author": "puppetlabs", "summary": "Offers support for basic management of PostgreSQL databases.", "license": "Apache-2.0", From 95922a8d7a28da009e13373ec51af31bdb7671ea Mon Sep 17 00:00:00 2001 From: Andrew Moore Date: Wed, 18 Dec 2024 15:53:22 +0000 Subject: [PATCH 49/57] Role Valid Until Date This allows for the valid until attribute to be set on roles. --- manifests/server/role.pp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/manifests/server/role.pp b/manifests/server/role.pp index 1b37ce282c..6103c19ac2 100644 --- a/manifests/server/role.pp +++ b/manifests/server/role.pp @@ -35,6 +35,7 @@ Boolean $inherit = true, Boolean $superuser = false, Boolean $replication = false, + Optional[String[1]] $valid_until = undef, String[1] $connection_limit = '-1', String[1] $username = $title, Hash $connect_settings = $postgresql::server::default_connect_settings, @@ -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": From c16d85059fea735fce8769ee4f1059a5785c7f29 Mon Sep 17 00:00:00 2001 From: Andrew Moore Date: Tue, 7 Jan 2025 09:45:18 +0000 Subject: [PATCH 50/57] Role valid_until documentation and tests --- manifests/server/role.pp | 1 + spec/defines/server_instance_spec.rb | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/manifests/server/role.pp b/manifests/server/role.pp index 6103c19ac2..f71ecf599c 100644 --- a/manifests/server/role.pp +++ b/manifests/server/role.pp @@ -11,6 +11,7 @@ # @param inherit Specifies whether to grant inherit capability for the new role. # @param superuser Specifies whether to grant super user capability for the new role. # @param replication Provides provides replication capabilities for this role if set to true. +# @param valid_until Specifies whether to set a valid until date for the role. # @param connection_limit Specifies how many concurrent connections the role can make. Default value: '-1', meaning no limit. # @param username Defines the username of the role to create. # @param connect_settings Specifies a hash of environment variables used when connecting to a remote server. diff --git a/spec/defines/server_instance_spec.rb b/spec/defines/server_instance_spec.rb index 89eadb06c8..ea63146fe4 100644 --- a/spec/defines/server_instance_spec.rb +++ b/spec/defines/server_instance_spec.rb @@ -73,7 +73,9 @@ class { 'postgresql::server': 'app_test1': { 'login' => true }, 'rep_test1': { 'replication' => true, 'login' => true }, - 'rou_test1': { 'login' => true }, }, + 'rou_test1': { 'login' => true }, + 'val_test1': { 'login' => true, + 'valid_until' => '2030-01-01 00:00:00+00' }, }, 'pg_hba_rules': { 'local all INSTANCE user': { 'type' => 'local', 'database' => 'all', 'user' => 'ins_test1', @@ -214,10 +216,19 @@ class { 'postgresql::server': it { is_expected.to contain_postgresql_psql('ALTER ROLE "rou_test1" NOCREATEROLE') } it { is_expected.to contain_postgresql_psql('ALTER ROLE "rou_test1" NOREPLICATION') } it { is_expected.to contain_postgresql_psql('ALTER ROLE "rou_test1" NOSUPERUSER') } + it { is_expected.to contain_postgresql_psql('ALTER ROLE "val_test1" CONNECTION LIMIT -1') } + it { is_expected.to contain_postgresql_psql('ALTER ROLE "val_test1" INHERIT') } + it { is_expected.to contain_postgresql_psql('ALTER ROLE "val_test1" LOGIN') } + it { is_expected.to contain_postgresql_psql('ALTER ROLE "val_test1" NOCREATEDB') } + it { is_expected.to contain_postgresql_psql('ALTER ROLE "val_test1" NOCREATEROLE') } + it { is_expected.to contain_postgresql_psql('ALTER ROLE "val_test1" NOREPLICATION') } + it { is_expected.to contain_postgresql_psql('ALTER ROLE "val_test1" NOSUPERUSER') } + it { is_expected.to contain_postgresql_psql('ALTER ROLE "val_test1" VALID UNTIL \'2030-01-01 00:00:00+00\'') } it { is_expected.to contain_postgresql_psql('CREATE ROLE app_test1 ENCRYPTED PASSWORD ****') } it { is_expected.to contain_postgresql_psql('CREATE ROLE dba_test1 ENCRYPTED PASSWORD ****') } it { is_expected.to contain_postgresql_psql('CREATE ROLE ins_test1 ENCRYPTED PASSWORD ****') } it { is_expected.to contain_postgresql_psql('CREATE ROLE rep_test1 ENCRYPTED PASSWORD ****') } it { is_expected.to contain_postgresql_psql('CREATE ROLE rou_test1 ENCRYPTED PASSWORD ****') } + it { is_expected.to contain_postgresql_psql('CREATE ROLE val_test1 ENCRYPTED PASSWORD ****') } end end From 6346da7be1986afcc5cebe79012bf664c80258c2 Mon Sep 17 00:00:00 2001 From: Shubham Shinde Date: Tue, 22 Apr 2025 12:37:56 +0530 Subject: [PATCH 51/57] (CAT-2296) Update github runner image to ubuntu-24.04 ubuntu-20.04 is not supported anymore: https://github.com/actions/runner-images/issues/11101 --- .github/workflows/ci.yml | 4 ++-- .github/workflows/nightly.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6dd8d7bc0..93cd3406b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,12 +10,12 @@ jobs: Spec: uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main" with: - runs_on: "ubuntu-20.04" + runs_on: "ubuntu-24.04" secrets: "inherit" Acceptance: needs: Spec uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main" with: - runs_on: "ubuntu-20.04" + runs_on: "ubuntu-24.04" secrets: "inherit" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b8786059ec..c6539f7e37 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -9,12 +9,12 @@ jobs: Spec: uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main" with: - runs_on: "ubuntu-20.04" + runs_on: "ubuntu-24.04" secrets: "inherit" Acceptance: needs: Spec uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main" with: - runs_on: "ubuntu-20.04" + runs_on: "ubuntu-24.04" secrets: "inherit" From 651c2b4ec0a3d9a76770369625b0a91bcba444ff Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Wed, 25 Oct 2023 18:22:34 +0200 Subject: [PATCH 52/57] add globals defaults for trixie debian version --- data/os/Debian/11.yaml | 4 ++++ manifests/globals.pp | 1 + metadata.json | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 data/os/Debian/11.yaml diff --git a/data/os/Debian/11.yaml b/data/os/Debian/11.yaml new file mode 100644 index 0000000000..227e596eb2 --- /dev/null +++ b/data/os/Debian/11.yaml @@ -0,0 +1,4 @@ +--- +# Defaults for Debian Bullseye (11) + +postgresql::globals::python_package_name: 'python3-psycopg2' diff --git a/manifests/globals.pp b/manifests/globals.pp index 64a4815fcc..f0eb07a9e8 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -210,6 +210,7 @@ '10' => '11', '11' => '13', '12' => '15', + '13' => '17', default => undef, }, 'Ubuntu' => $facts['os']['release']['major'] ? { diff --git a/metadata.json b/metadata.json index 6ad73624ec..a991913a27 100644 --- a/metadata.json +++ b/metadata.json @@ -60,7 +60,8 @@ "operatingsystemrelease": [ "10", "11", - "12" + "12", + "13" ] }, { From 79c7c0ac6285a4bdbedaa208672d279b76d9d482 Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Thu, 11 Sep 2025 23:58:54 -0700 Subject: [PATCH 53/57] Allow puppetlabs/apt 11.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index a991913a27..e5f8cd35a3 100644 --- a/metadata.json +++ b/metadata.json @@ -14,7 +14,7 @@ }, { "name": "puppetlabs/apt", - "version_requirement": ">= 9.2.0 < 11.0.0" + "version_requirement": ">= 9.2.0 < 12.0.0" }, { "name": "puppet/systemd", From 9189e813aaeebc8b8ddcd654255dd1b0e5e80791 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 30 Sep 2025 11:16:16 +0200 Subject: [PATCH 54/57] puppet/systemd: Allow 9.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index e5f8cd35a3..552a48b38b 100644 --- a/metadata.json +++ b/metadata.json @@ -18,7 +18,7 @@ }, { "name": "puppet/systemd", - "version_requirement": ">= 4.0.1 < 9.0.0" + "version_requirement": ">= 4.0.1 < 10.0.0" }, { "name": "puppetlabs/concat", From 45d8a9d4a17c13890070e305c9a2fa08468aa24f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 30 Sep 2025 11:57:59 +0200 Subject: [PATCH 55/57] Debian 11: Use correct package name for python bindings Since Debian 11 was added to this module, the package name was wrong. It was set to python-psycopg2, but the correct name is python3-psycopg2. There's a longer analysis about this bug in https://github.com/puppetlabs/puppetlabs-postgresql/pull/1638/files#r2390588710 tl;dr: * Debian 10 used python-psycopg2 and that was set by the module * Debian 11 was added without proper acceptance testing * Later on unit tests were added for Debian 11, but still with the wrong package name * 651c2b4ec0a3d9a76770369625b0a91bcba444ff fixed the package name, but in the wrong place and didn't adjust the tests * That resulted in a broken pipeline, that's how I found all of this This patch: * Cleans up the hiera data * sets the package name at the correct location * adjusts the debian 11 unit test for the new package name * Adds tests for Debian 12 and 13 (won't be executed right now because Perforce ships a too old version of FacterDB) Edit: Had to remove Debian 13 because the pipeline fails if it cannot find a factset. --- data/os/Debian/11.yaml | 4 ---- manifests/params.pp | 4 ++-- spec/classes/lib/python_spec.rb | 13 ++++++++++++- spec/spec_helper_local.rb | 4 ++++ 4 files changed, 18 insertions(+), 7 deletions(-) delete mode 100644 data/os/Debian/11.yaml diff --git a/data/os/Debian/11.yaml b/data/os/Debian/11.yaml deleted file mode 100644 index 227e596eb2..0000000000 --- a/data/os/Debian/11.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -# Defaults for Debian Bullseye (11) - -postgresql::globals::python_package_name: 'python3-psycopg2' diff --git a/manifests/params.pp b/manifests/params.pp index 8441aa829c..55dcd24c0f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -161,9 +161,9 @@ $plpython_package_name = pick($plpython_package_name, "postgresql-plpython-${version}") $_ubuntu_2204 = ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '22.04') >= 0) - $_debian_12 = ($facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['full'], '12') >= 0) + $_debian_11 = ($facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['full'], '11') >= 0) - if $_ubuntu_2204 or $_debian_12 { + if $_ubuntu_2204 or $_debian_11 { $python_package_name = pick($python_package_name, 'python3-psycopg2') } else { $python_package_name = pick($python_package_name, 'python-psycopg2') diff --git a/spec/classes/lib/python_spec.rb b/spec/classes/lib/python_spec.rb index 86093bc7e0..64e426ca39 100644 --- a/spec/classes/lib/python_spec.rb +++ b/spec/classes/lib/python_spec.rb @@ -30,7 +30,18 @@ it { expect(subject).to contain_package('python-psycopg2').with( - name: 'python-psycopg2', + name: 'python3-psycopg2', + ensure: 'present', + ) + } + end + + describe 'on debian 12' do + include_examples 'Debian 12' + + it { + expect(subject).to contain_package('python-psycopg2').with( + name: 'python3-psycopg2', ensure: 'present', ) } diff --git a/spec/spec_helper_local.rb b/spec/spec_helper_local.rb index c9603be72a..930b943217 100644 --- a/spec/spec_helper_local.rb +++ b/spec/spec_helper_local.rb @@ -184,6 +184,10 @@ def param(type, title, param) let(:facts) { on_supported_os['debian-11-x86_64'] } end +shared_context 'Debian 12' do + let(:facts) { on_supported_os['debian-12-x86_64'] } +end + shared_context 'Ubuntu 18.04' do let(:facts) { on_supported_os['ubuntu-18.04-x86_64'] } end From fe40cd36e35577af085d126a660b81d11c531fc5 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 13 Oct 2025 08:06:35 +0000 Subject: [PATCH 56/57] Release prep v10.6.0 --- CHANGELOG.md | 21 ++++++++++++++++++++- REFERENCE.md | 9 +++++++++ metadata.json | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e28d5a2f94..487ea482a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [v10.6.0](https://github.com/puppetlabs/puppetlabs-postgresql/tree/v10.6.0) - 2025-10-13 + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v10.5.0...v10.6.0) + +### Added + +- Allow puppetlabs/apt 11.x & puppet/systemd 9.x [#1645](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1645) ([kenyon](https://github.com/kenyon)) +- Add support for Debian 13 (trixie) [#1638](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1638) ([trefzer](https://github.com/trefzer)) +- Role: Add support for valid_until [#1624](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1624) ([mooreandrew](https://github.com/mooreandrew)) + +### Fixed + +- Debian 11: Use correct package name for python bindings [#1647](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1647) ([bastelfreak](https://github.com/bastelfreak)) +- Unbreak Debian support with custom encoding [#1564](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1564) ([smortex](https://github.com/smortex)) + +### Other + +- (CAT-2296) Update github runner image to ubuntu-24.04 [#1636](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1636) ([shubhamshinde360](https://github.com/shubhamshinde360)) + ## [v10.5.0](https://github.com/puppetlabs/puppetlabs-postgresql/tree/v10.5.0) - 2025-01-07 [Full Changelog](https://github.com/puppetlabs/puppetlabs-postgresql/compare/v10.4.0...v10.5.0) @@ -352,7 +371,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ### Fixed -- Do not add version component to repo definition [#1282](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1282) ([weastur](https://github.com/weastur)) +- Do not add version component to repo definition [#1282](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1282) ([psapezhka](https://github.com/psapezhka)) - (MODULES-8700) Autorequire the service in postgresql_psql [#1276](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1276) ([ekohl](https://github.com/ekohl)) ## [v7.2.0](https://github.com/puppetlabs/puppetlabs-postgresql/tree/v7.2.0) - 2021-05-24 diff --git a/REFERENCE.md b/REFERENCE.md index 247b58c952..bf3ffc306f 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -3677,6 +3677,7 @@ The following parameters are available in the `postgresql::server::role` defined * [`inherit`](#-postgresql--server--role--inherit) * [`superuser`](#-postgresql--server--role--superuser) * [`replication`](#-postgresql--server--role--replication) +* [`valid_until`](#-postgresql--server--role--valid_until) * [`connection_limit`](#-postgresql--server--role--connection_limit) * [`username`](#-postgresql--server--role--username) * [`connect_settings`](#-postgresql--server--role--connect_settings) @@ -3769,6 +3770,14 @@ Provides provides replication capabilities for this role if set to true. Default value: `false` +##### `valid_until` + +Data type: `Optional[String[1]]` + +Specifies whether to set a valid until date for the role. + +Default value: `undef` + ##### `connection_limit` Data type: `String[1]` diff --git a/metadata.json b/metadata.json index 552a48b38b..82cb5fa869 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-postgresql", - "version": "10.5.0", + "version": "10.6.0", "author": "puppetlabs", "summary": "Offers support for basic management of PostgreSQL databases.", "license": "Apache-2.0", From e57da89d3476f2dc9d1db4b2a5e88cc955d0db9d Mon Sep 17 00:00:00 2001 From: Ben Morrice Date: Fri, 30 Aug 2024 11:31:48 +0200 Subject: [PATCH 57/57] Don't use type alias in `postgresql_password` Type aliases from modules aren't available on the agent. See https://puppet.atlassian.net/browse/PUP-7197 This means that calls to `postgresql::postgresql_password` can't be deferred if the `hash` parameter uses the type `Postgresql::Pg_password_encryption`. Instead we have to use the raw `Enum`, (which unfortunately causes code duplication, but this is unavoidable). Using this function with `Deferred` is not just a theoretical use-case. The module itself tries to here. https://github.com/puppetlabs/puppetlabs-postgresql/blob/20704ffae24dcf970784697b1798c09d026fb7f8/manifests/server/role.pp#L162 --- .../postgresql/postgresql_password.rb | 3 +- spec/acceptance/db_deferred_spec.rb | 30 +++++++++++++++++++ types/pg_password_encryption.pp | 2 ++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 spec/acceptance/db_deferred_spec.rb diff --git a/lib/puppet/functions/postgresql/postgresql_password.rb b/lib/puppet/functions/postgresql/postgresql_password.rb index a444d5cd01..9ca4d81dbb 100644 --- a/lib/puppet/functions/postgresql/postgresql_password.rb +++ b/lib/puppet/functions/postgresql/postgresql_password.rb @@ -24,7 +24,8 @@ required_param 'Variant[String[1], Integer]', :username required_param 'Variant[String[1], Sensitive[String[1]], Integer]', :password optional_param 'Boolean', :sensitive - optional_param 'Optional[Postgresql::Pg_password_encryption]', :hash + # The following Enum is also defined in `types/pg_password_encryption.pp` but type alias can't be used in Deferred functions. + optional_param 'Optional[Enum["md5", "scram-sha-256"]]', :hash optional_param 'Optional[Variant[String[1], Integer]]', :salt return_type 'Variant[String, Sensitive[String]]' end diff --git a/spec/acceptance/db_deferred_spec.rb b/spec/acceptance/db_deferred_spec.rb new file mode 100644 index 0000000000..731e0742b8 --- /dev/null +++ b/spec/acceptance/db_deferred_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require 'spec_helper_acceptance' + +describe 'postgresql::server::db:' do + let(:user) { 'user_test' } + let(:password) { 'deferred_password_test' } + let(:database) { 'test_database' } + + let(:pp_one) do + <<~MANIFEST + $user = '#{user}' + $password = '#{password}' + $database = '#{database}' + + include postgresql::server + postgresql::server::db { $database: + user => $user, + password => Deferred('unwrap', [$password]), + } + MANIFEST + end + + it 'creates a database with with the password in the deferred function' do + apply_manifest(pp_one) + psql_cmd = "PGPASSWORD=#{password} PGUSER=#{user} PGDATABASE=#{database} psql -h 127.0.0.1 -d postgres -c '\\q'" + run_shell("cd /tmp; su #{shellescape('postgres')} -c #{shellescape(psql_cmd)}", + acceptable_exit_codes: [0]) + end +end diff --git a/types/pg_password_encryption.pp b/types/pg_password_encryption.pp index b2b5be66e5..7512174a89 100644 --- a/types/pg_password_encryption.pp +++ b/types/pg_password_encryption.pp @@ -1,2 +1,4 @@ # @summary the supported password_encryption +# Note that this Enum is also defined in: +# lib/puppet/functions/postgresql/postgresql_password.rb type Postgresql::Pg_password_encryption = Enum['md5', 'scram-sha-256']