Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Debian 11: Use correct package name for python bindings
Since Debian 11 was added to this module, the package name was wrong. It
was set to python-psycopg2, but the correct name is python3-psycopg2.

There's a longer analysis about this bug in https://github.com/puppetlabs/puppetlabs-postgresql/pull/1638/files#r2390588710

tl;dr:

* Debian 10 used python-psycopg2 and that was set by the module
* Debian 11 was added without proper acceptance testing
* Later on unit tests were added for Debian 11, but still with the wrong
  package name
* 651c2b4 fixed the package name, but
  in the wrong place and didn't adjust the tests
* That resulted in a broken pipeline, that's how I found all of this

This patch:
* Cleans up the hiera data
* sets the package name at the correct location
* adjusts the debian 11 unit test for the new package name
* Adds tests for Debian 12 and 13 (won't be executed right now because
  Perforce ships a too old version of FacterDB)

Edit: Had to remove Debian 13 because the pipeline fails if it cannot
find a factset.
  • Loading branch information
bastelfreak committed Sep 30, 2025
commit 45d8a9d4a17c13890070e305c9a2fa08468aa24f
4 changes: 0 additions & 4 deletions data/os/Debian/11.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@
$plpython_package_name = pick($plpython_package_name, "postgresql-plpython-${version}")

$_ubuntu_2204 = ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '22.04') >= 0)
$_debian_12 = ($facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['full'], '12') >= 0)
$_debian_11 = ($facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['full'], '11') >= 0)

if $_ubuntu_2204 or $_debian_12 {
if $_ubuntu_2204 or $_debian_11 {
$python_package_name = pick($python_package_name, 'python3-psycopg2')
} else {
$python_package_name = pick($python_package_name, 'python-psycopg2')
Expand Down
13 changes: 12 additions & 1 deletion spec/classes/lib/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,18 @@

it {
expect(subject).to contain_package('python-psycopg2').with(
name: 'python-psycopg2',
name: 'python3-psycopg2',
ensure: 'present',
)
}
end

describe 'on debian 12' do
include_examples 'Debian 12'

it {
expect(subject).to contain_package('python-psycopg2').with(
name: 'python3-psycopg2',
ensure: 'present',
)
}
Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper_local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ def param(type, title, param)
let(:facts) { on_supported_os['debian-11-x86_64'] }
end

shared_context 'Debian 12' do
let(:facts) { on_supported_os['debian-12-x86_64'] }
end

shared_context 'Ubuntu 18.04' do
let(:facts) { on_supported_os['ubuntu-18.04-x86_64'] }
end
Expand Down
Loading