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" 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/labeller.yml b/.github/workflows/labeller.yml deleted file mode 100644 index ee149bf525..0000000000 --- a/.github/workflows/labeller.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Labeller - -on: - issues: - types: - - opened - - labeled - - unlabeled - pull_request_target: - 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 }} 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" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b7b8a05dd..4b3b80fc80 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: "Publish module" on: workflow_dispatch: - + jobs: release: uses: "puppetlabs/cat-github-actions/.github/workflows/module_release.yml@main" 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 7a66e08331..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: @@ -529,6 +529,8 @@ Lint/DuplicateBranch: Enabled: false Lint/DuplicateMagicComment: Enabled: false +Lint/DuplicateMatchPattern: + Enabled: false Lint/DuplicateRegexpCharacterClassElement: Enabled: false Lint/EmptyBlock: @@ -645,6 +647,8 @@ Style/ComparableClamp: Enabled: false Style/ConcatArrayLiterals: Enabled: false +Style/DataInheritance: + Enabled: false Style/DirEmpty: Enabled: false Style/DocumentDynamicEvalDefinition: @@ -713,6 +717,8 @@ Style/RedundantHeredocDelimiterQuotes: Enabled: false Style/RedundantInitialize: Enabled: false +Style/RedundantLineContinuation: + Enabled: false Style/RedundantSelfAssignmentBranch: Enabled: false Style/RedundantStringEscape: diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 2f1e4f73a5..6da8d472f8 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,6 @@ { "recommendations": [ "puppet.puppet-vscode", - "rebornix.Ruby" + "Shopify.ruby-lsp" ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index d259b3adc9..e28d5a2f94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,74 @@ 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.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) + +### 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) + +### 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) + +### 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) + +### 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) @@ -37,6 +105,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)) @@ -137,6 +206,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 @@ -216,6 +286,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 @@ -223,8 +294,8 @@ 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)) -- Make ::contrib a noop on OSes without a contrib package [#1309](https://github.com/puppetlabs/puppetlabs-postgresql/pull/1309) ([carlosduelo](https://github.com/carlosduelo)) +- 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) ([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)) @@ -326,6 +397,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)) @@ -492,6 +564,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)) @@ -590,6 +663,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 @@ -675,6 +749,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/Gemfile b/Gemfile index 86e337adbc..7a1566ddb4 100644 --- a/Gemfile +++ b/Gemfile @@ -20,30 +20,31 @@ 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 "metadata-json-lint", '~> 3.0', require: false + gem "facterdb", '~> 1.18', require: false + gem "metadata-json-lint", '~> 4.0', require: false gem "rspec-puppet-facts", '~> 2.0', require: false - gem "codecov", '~> 0.2', require: false gem "dependency_checker", '~> 1.0.0', require: false gem "parallel_tests", '= 3.12.1', require: false gem "pry", '~> 0.10', require: false - gem "simplecov-console", '~> 0.5', require: false + gem "simplecov-console", '~> 0.9', require: false gem "puppet-debugger", '~> 1.0', require: false - gem "rubocop", '= 1.48.1', require: false + gem "rubocop", '~> 1.50.0', require: false gem "rubocop-performance", '= 1.16.0', require: false gem "rubocop-rspec", '= 2.19.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 :system_tests do - gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] - gem "serverspec", '~> 2.41', require: false -end -group :release_prep do +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 puppet_version = ENV['PUPPET_GEM_VERSION'] facter_version = ENV['FACTER_GEM_VERSION'] diff --git a/README.md b/README.md index c7189eb025..8f7141dbb3 100644 --- a/README.md +++ b/README.md @@ -74,14 +74,50 @@ 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) -**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 @@ -95,7 +131,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 ( @@ -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. diff --git a/REFERENCE.md b/REFERENCE.md index 4a2b80dd15..247b58c952 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]` @@ -1536,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` @@ -1577,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. @@ -1738,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` @@ -1805,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. @@ -3960,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` @@ -4039,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/Rakefile b/Rakefile index a40e488df7..32f4fa9e14 100644 --- a/Rakefile +++ b/Rakefile @@ -4,88 +4,8 @@ require 'bundler' require 'puppet_litmus/rake_tasks' if Gem.loaded_specs.key? 'puppet_litmus' require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-syntax/tasks/puppet-syntax' -require 'github_changelog_generator/task' if Gem.loaded_specs.key? 'github_changelog_generator' require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings' -def changelog_user - return unless Rake.application.top_level_tasks.include? "changelog" - returnVal = "puppetlabs" || JSON.load(File.read('metadata.json'))['author'] - raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil? - puts "GitHubChangelogGenerator user:#{returnVal}" - returnVal -end - -def changelog_project - return unless Rake.application.top_level_tasks.include? "changelog" - - returnVal = nil - returnVal ||= begin - metadata_source = JSON.load(File.read('metadata.json'))['source'] - metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z}) - - metadata_source_match && metadata_source_match[1] - end - - raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil? - - puts "GitHubChangelogGenerator project:#{returnVal}" - returnVal -end - -def changelog_future_release - return unless Rake.application.top_level_tasks.include? "changelog" - returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version'] - raise "unable to find the future_release (version) in metadata.json" if returnVal.nil? - puts "GitHubChangelogGenerator future_release:#{returnVal}" - returnVal -end - PuppetLint.configuration.send('disable_relative') PuppetLint.configuration.send('disable_anchor_resource') PuppetLint.configuration.send('disable_params_empty_string_assignment') - - -if Gem.loaded_specs.key? 'github_changelog_generator' - GitHubChangelogGenerator::RakeTask.new :changelog do |config| - raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil? - config.user = "#{changelog_user}" - config.project = "#{changelog_project}" - config.max_issues = 500 - config.future_release = "#{changelog_future_release}" - config.exclude_labels = ['maintenance'] - config.header = "# Change log\n\nAll 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)." - config.add_pr_wo_labels = true - config.issues = false - config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB" - config.configure_sections = { - "Changed" => { - "prefix" => "### Changed", - "labels" => ["backwards-incompatible"], - }, - "Added" => { - "prefix" => "### Added", - "labels" => ["enhancement", "feature"], - }, - "Fixed" => { - "prefix" => "### Fixed", - "labels" => ["bug", "documentation", "bugfix"], - }, - } - end -else - desc 'Generate a Changelog from GitHub' - task :changelog do - raise < 1.15' - condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')" -EOM - end -end - 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/lib/puppet/provider/postgresql_conf/ruby.rb b/lib/puppet/provider/postgresql_conf/ruby.rb index ab89864d10..f21caf2b5c 100644 --- a/lib/puppet/provider/postgresql_conf/ruby.rb +++ b/lib/puppet/provider/postgresql_conf/ruby.rb @@ -10,19 +10,16 @@ Puppet::Type.type(:postgresql_conf).provide(:ruby) do desc 'Set keys, values and comments in a postgresql config file.' - # The function pareses the postgresql.conf and figures out which active settings exist in a config file and returns an array of hashes + # 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| - 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] @@ -36,7 +33,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 @@ -63,18 +60,17 @@ 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 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 @@ -85,23 +81,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 +110,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 +118,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 +131,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 diff --git a/lib/puppet/type/postgresql_psql.rb b/lib/puppet/type/postgresql_psql.rb index 021753e7ab..d0101857c0 100644 --- a/lib/puppet/type/postgresql_psql.rb +++ b/lib/puppet/type/postgresql_psql.rb @@ -135,11 +135,7 @@ def matches(value) end autorequire(:anchor) do - ["postgresql::server::service::begin::#{self[:instance]}"] - end - - autorequire(:service) do - ["postgresqld_instance_#{self[:instance]}"] + ["postgresql::server::service::end::#{self[:instance]}"] end def should_run_sql(refreshing = false) 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', diff --git a/manifests/globals.pp b/manifests/globals.pp index a193a962c8..64a4815fcc 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, @@ -175,7 +180,8 @@ $default_version = $facts['os']['family'] ? { /^(RedHat|Linux)/ => $facts['os']['name'] ? { 'Fedora' => $facts['os']['release']['major'] ? { - /^(38)$/ => '15', + /^(40|41)$/ => '16', + /^(38|39)$/ => '15', /^(36|37)$/ => '14', /^(34|35)$/ => '13', /^(32|33)$/ => '12', @@ -211,6 +217,7 @@ /^(20.04)$/ => '12', /^(21.04|21.10)$/ => '13', /^(22.04)$/ => '14', + /^(24.04)$/ => '16', default => undef, }, default => undef, @@ -230,7 +237,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'] ? { @@ -259,6 +266,7 @@ '10' => '2.4', '11' => '3.0', '12' => '3.0', + '16' => '3.4', default => undef, } $globals_postgis_version = $postgis_version ? { 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/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/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/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}"] } } 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/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': } } diff --git a/manifests/server/role.pp b/manifests/server/role.pp index 1b37ce282c..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. @@ -35,6 +36,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 +128,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": 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 74453a0310..6ad73624ec 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-postgresql", - "version": "10.0.3", + "version": "10.5.0", "author": "puppetlabs", "summary": "Offers support for basic management of PostgreSQL databases.", "license": "Apache-2.0", @@ -14,11 +14,11 @@ }, { "name": "puppetlabs/apt", - "version_requirement": ">= 2.0.0 < 10.0.0" + "version_requirement": ">= 9.2.0 < 11.0.0" }, { "name": "puppet/systemd", - "version_requirement": ">= 4.0.1 < 7.0.0" + "version_requirement": ">= 4.0.1 < 9.0.0" }, { "name": "puppetlabs/concat", @@ -38,13 +38,15 @@ "operatingsystem": "CentOS", "operatingsystemrelease": [ "7", - "8" + "8", + "9" ] }, { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ - "7" + "7", + "9" ] }, { @@ -57,7 +59,8 @@ "operatingsystem": "Debian", "operatingsystemrelease": [ "10", - "11" + "11", + "12" ] }, { @@ -72,19 +75,22 @@ "operatingsystemrelease": [ "18.04", "20.04", - "22.04" + "22.04", + "24.04" ] }, { "operatingsystem": "Rocky", "operatingsystemrelease": [ - "8" + "8", + "9" ] }, { "operatingsystem": "AlmaLinux", "operatingsystemrelease": [ - "8" + "8", + "9" ] } ], @@ -94,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-g01c6a19" + "template-ref": "tags/3.2.0.4-0-g5d17ec1" } diff --git a/spec/acceptance/utf8_encoding_spec.rb b/spec/acceptance/aaa_spec.rb similarity index 92% rename from spec/acceptance/utf8_encoding_spec.rb rename to spec/acceptance/aaa_spec.rb index b816842138..a7c9b52497 100644 --- a/spec/acceptance/utf8_encoding_spec.rb +++ b/spec/acceptance/aaa_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': diff --git a/spec/acceptance/server_instance_spec.rb b/spec/acceptance/server_instance_spec.rb index 93192bafb3..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': @@ -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 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 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 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 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| 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': 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 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' { -%> pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy