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/manifests/server/config_entry.pp b/manifests/server/config_entry.pp index d17b844a18..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', @@ -12,6 +13,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 +74,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 +92,6 @@ key => $key, value => $value, comment => $comment, - require => Class['postgresql::server::initdb'], + require => Postgresql::Server::Instance::Initdb[$instance_name], } } 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 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/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/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], } } } 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 49d2bbb8f7..5ef8dec527 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, } @@ -84,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| { @@ -108,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| { @@ -120,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| { @@ -127,6 +134,7 @@ * => $tgrants, psql_user => $instance_user, port => $config_settings['port'], + instance => $instance_name, } } } diff --git a/metadata.json b/metadata.json index 348ca30e5e..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", @@ -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", 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
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: