Skip to content

Commit 45d8a9d

Browse files
committed
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.
1 parent 9189e81 commit 45d8a9d

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

data/os/Debian/11.yaml

Lines changed: 0 additions & 4 deletions
This file was deleted.

manifests/params.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@
161161
$plpython_package_name = pick($plpython_package_name, "postgresql-plpython-${version}")
162162

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

166-
if $_ubuntu_2204 or $_debian_12 {
166+
if $_ubuntu_2204 or $_debian_11 {
167167
$python_package_name = pick($python_package_name, 'python3-psycopg2')
168168
} else {
169169
$python_package_name = pick($python_package_name, 'python-psycopg2')

spec/classes/lib/python_spec.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,18 @@
3030

3131
it {
3232
expect(subject).to contain_package('python-psycopg2').with(
33-
name: 'python-psycopg2',
33+
name: 'python3-psycopg2',
34+
ensure: 'present',
35+
)
36+
}
37+
end
38+
39+
describe 'on debian 12' do
40+
include_examples 'Debian 12'
41+
42+
it {
43+
expect(subject).to contain_package('python-psycopg2').with(
44+
name: 'python3-psycopg2',
3445
ensure: 'present',
3546
)
3647
}

spec/spec_helper_local.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ def param(type, title, param)
184184
let(:facts) { on_supported_os['debian-11-x86_64'] }
185185
end
186186

187+
shared_context 'Debian 12' do
188+
let(:facts) { on_supported_os['debian-12-x86_64'] }
189+
end
190+
187191
shared_context 'Ubuntu 18.04' do
188192
let(:facts) { on_supported_os['ubuntu-18.04-x86_64'] }
189193
end

0 commit comments

Comments
 (0)