Skip to content

Commit

Permalink
Merge branch 'main' into unbreak-debian-support-with-encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
rajat-puppet committed Jun 6, 2024
2 parents e74c6b0 + 880a6f7 commit 50226f2
Show file tree
Hide file tree
Showing 16 changed files with 93 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/labeller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- opened
- labeled
- unlabeled
pull_request_target:
pull_request:
types:
- opened
- labeled
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/mend.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: "mend"

on:
pull_request_target:
types:
- opened
- synchronize
pull_request:
branches:
- "main"
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
Expand Down
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -244,14 +258,15 @@ 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

- 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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))

Expand Down
27 changes: 27 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

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

Expand Down Expand Up @@ -1587,6 +1588,14 @@ Defines the comment for the setting. The # is added by default.

Default value: `undef`

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

Data type: `String[1]`

The name of the instance.

Default value: `'main'`

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

Define for creating a database.
Expand Down Expand Up @@ -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)

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

Expand Down Expand Up @@ -1815,6 +1825,14 @@ Port to use when connecting.

Default value: `$postgresql::server::port`

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

Data type: `String[1]`

The name of the Postgresql database instance.

Default value: `'main'`

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

Define for conveniently creating a role, database and assigning the correct permissions.
Expand Down Expand Up @@ -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)

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

Expand Down Expand Up @@ -4049,6 +4068,14 @@ Create grant only if it doesn't exist.

Default value: `false`

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

Data type: `String[1]`

The name of the Postgresql database instance.

Default value: `'main'`

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

This module creates tablespace.
Expand Down
10 changes: 6 additions & 4 deletions manifests/server/config_entry.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
# @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',
String[1] $key = $name,
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.
Expand Down Expand Up @@ -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],
}
}

Expand All @@ -90,6 +92,6 @@
key => $key,
value => $value,
comment => $comment,
require => Class['postgresql::server::initdb'],
require => Postgresql::Server::Instance::Initdb[$instance_name],
}
}
2 changes: 1 addition & 1 deletion manifests/server/database.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions manifests/server/database_grant.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -32,5 +34,6 @@
group => $psql_group,
port => $port,
connect_settings => $connect_settings,
instance => $instance,
}
}
3 changes: 3 additions & 0 deletions manifests/server/db.pp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
port => $port,
user => $psql_user,
group => $psql_group,
instance => $instance,
}
}

Expand All @@ -54,6 +55,7 @@
psql_user => $psql_user,
psql_group => $psql_group,
before => Postgresql::Server::Database[$dbname],
instance => $instance,
}
}

Expand All @@ -65,6 +67,7 @@
port => $port,
psql_user => $psql_user,
psql_group => $psql_group,
instance => $instance,
} -> Postgresql_conn_validator<| db_name == $dbname |>
}

Expand Down
4 changes: 2 additions & 2 deletions manifests/server/instance/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -249,7 +249,7 @@
group => $group,
mode => '0640',
warn => true,
notify => Class['postgresql::server::reload'],
notify => Postgresql::Server::Instance::Reload[$name],
}
}

Expand Down
2 changes: 1 addition & 1 deletion manifests/server/instance/reload.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
command => $service_reload,
onlyif => $service_status,
refreshonly => true,
require => Class['postgresql::server::service'],
require => Postgresql::Server::Instance::Service[$name],
}
}
4 changes: 2 additions & 2 deletions manifests/server/instance/systemd.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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],
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions manifests/server/table_grant.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -37,5 +39,6 @@
psql_user => $psql_user,
onlyif_exists => $onlyif_exists,
connect_settings => $connect_settings,
instance => $instance,
}
}
26 changes: 17 additions & 9 deletions manifests/server_instance.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -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| {
Expand All @@ -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| {
Expand All @@ -120,13 +126,15 @@
psql_user => $instance_user,
psql_group => $instance_group,
port => $config_settings['port'],
instance => $instance_name,
}
}
$table_grants.each |$table_grant_title, $tgrants| {
postgresql::server::table_grant { $table_grant_title:
* => $tgrants,
psql_user => $instance_user,
port => $config_settings['port'],
instance => $instance_name,
}
}
}
Loading

0 comments on commit 50226f2

Please sign in to comment.