From 642423a7a8fe22efc9c85ff44a2ff673980cb5a9 Mon Sep 17 00:00:00 2001 From: Francesco Di Nucci Date: Mon, 13 Apr 2026 11:40:32 +0200 Subject: [PATCH] feat: EL10 support Add an "unholy hack" (quote) to support EL10 while it's added to postgresql Co-authored-by: Corporate Gadfly --- data/os/RedHat/10.yaml | 3 +++ hiera.yaml | 14 ++++++++++ manifests/database/postgresql.pp | 2 ++ metadata.json | 15 +++++++---- .../support/acceptance/shared/puppetserver.pp | 26 ++++++++++++------- spec/unit/classes/init_spec.rb | 17 +++++++++--- 6 files changed, 59 insertions(+), 18 deletions(-) create mode 100644 data/os/RedHat/10.yaml create mode 100644 hiera.yaml diff --git a/data/os/RedHat/10.yaml b/data/os/RedHat/10.yaml new file mode 100644 index 0000000..986711e --- /dev/null +++ b/data/os/RedHat/10.yaml @@ -0,0 +1,3 @@ +--- +# As of v10.6.1, puppetlabs/postgresql does not have EL10 support/data +openvoxdb::postgres_version: '16' \ No newline at end of file diff --git a/hiera.yaml b/hiera.yaml new file mode 100644 index 0000000..3ba202c --- /dev/null +++ b/hiera.yaml @@ -0,0 +1,14 @@ +--- +version: 5 + +hierarchy: + - name: "OS version" + path: "os/%{facts.os.family}/%{facts.os.name}/%{facts.os.release.major}.yaml" + - name: "OS variant" + path: "os/%{facts.os.family}/%{facts.os.name}.yaml" + - name: "OS family/major" + path: "os/%{facts.os.family}/%{facts.os.release.major}.yaml" + - name: "OS family" + path: "os/%{facts.os.family}.yaml" + - name: "common" + path: "common.yaml" diff --git a/manifests/database/postgresql.pp b/manifests/database/postgresql.pp index bf6275f..45723ca 100644 --- a/manifests/database/postgresql.pp +++ b/manifests/database/postgresql.pp @@ -97,9 +97,11 @@ ) inherits openvoxdb::params { if $manage_server { class { 'postgresql::globals': + manage_dnf_module => false, # disable DNF module on EL8, EL9 and EL10 manage_package_repo => $manage_package_repo, version => $postgres_version, } + # get the pg server up and running class { 'postgresql::server': ip_mask_allow_all_users => '0.0.0.0/0', diff --git a/metadata.json b/metadata.json index 3abd670..4de11f8 100644 --- a/metadata.json +++ b/metadata.json @@ -30,13 +30,15 @@ "operatingsystem": "AlmaLinux", "operatingsystemrelease": [ "8", - "9" + "9", + "10" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "9" + "9", + "10" ] }, { @@ -51,21 +53,24 @@ "operatingsystem": "OracleLinux", "operatingsystemrelease": [ "8", - "9" + "9", + "10" ] }, { "operatingsystem": "RedHat", "operatingsystemrelease": [ "8", - "9" + "9", + "10" ] }, { "operatingsystem": "Rocky", "operatingsystemrelease": [ "8", - "9" + "9", + "10" ] }, { diff --git a/spec/support/acceptance/shared/puppetserver.pp b/spec/support/acceptance/shared/puppetserver.pp index e50d851..3d4744c 100644 --- a/spec/support/acceptance/shared/puppetserver.pp +++ b/spec/support/acceptance/shared/puppetserver.pp @@ -12,17 +12,25 @@ # TODO: backport to litmusimage, required for serverspec port tests package { 'iproute': ensure => installed } - # TODO: rework this hack, maybe not needed for newer version of postgresl module? + # EL 8 and 9 ship a built-in DNF module for postgresql that must be disabled + # before installing from the upstream PGDG repo. EL 10 dropped the module stream. if versioncmp($facts['os']['release']['major'], '8') >= 0 { - package { 'disable-builtin-dnf-postgresql-module': - ensure => 'disabled', - name => 'postgresql', - provider => 'dnfmodule', - } + if versioncmp($facts['os']['release']['major'], '10') < 0 { + # EL 8 and 9 + package { 'disable-builtin-dnf-postgresql-module': + ensure => 'disabled', + name => 'postgresql', + provider => 'dnfmodule', + } - Yumrepo <| tag == 'postgresql::repo' |> - -> Package['disable-dnf-postgresql-module'] - -> Package <| tag == 'postgresql' |> + Yumrepo <| tag == 'postgresql::repo' |> + -> Package['disable-builtin-dnf-postgresql-module'] + -> Package <| tag == 'postgresql' |> + } else { + # EL 10 + Yumrepo <| tag == 'postgresql::repo' |> + -> Package <| tag == 'postgresql' |> + } } } diff --git a/spec/unit/classes/init_spec.rb b/spec/unit/classes/init_spec.rb index 3c07f7f..c1fd606 100644 --- a/spec/unit/classes/init_spec.rb +++ b/spec/unit/classes/init_spec.rb @@ -19,10 +19,19 @@ describe 'without managed postgresql' do let :pre_condition do - <<-HEREDOC - class { 'postgresql::server': - } - HEREDOC + if facts.dig(:os, 'family') == 'RedHat' && facts.dig(:os, 'release', 'major') == '10' + <<-HEREDOC + class { 'postgresql::globals': + version => '16', + } + -> class { 'postgresql::server': } + HEREDOC + else + <<-HEREDOC + class { 'postgresql::server': + } + HEREDOC + end end let :params do