Skip to content

Commit 1f352c1

Browse files
authored
Merge pull request #1316 from kajinamit/python-pkg
Fix python package name in RHEL/CentOS 8
2 parents dd190cd + 8f8e2c8 commit 1f352c1

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

manifests/params.pp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@
109109
$psql_path = pick($psql_path, "${bindir}/psql")
110110

111111
$perl_package_name = pick($perl_package_name, 'perl-DBD-Pg')
112-
$python_package_name = pick($python_package_name, 'python-psycopg2')
112+
if $facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'], '8') >= 0 {
113+
$python_package_name = pick($python_package_name, 'python3-psycopg2')
114+
} else {
115+
$python_package_name = pick($python_package_name, 'python-psycopg2')
116+
}
113117

114118
if $postgresql::globals::postgis_package_name {
115119
$postgis_package_name = $postgresql::globals::postgis_package_name

spec/unit/classes/lib/python_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,25 @@
2222
}
2323
end
2424

25+
describe 'on a redhat based os with python 3' do
26+
let :facts do
27+
{
28+
os: {
29+
family: 'RedHat',
30+
name: 'RedHat',
31+
release: { 'full' => '8.2', 'major' => '8' },
32+
},
33+
}
34+
end
35+
36+
it {
37+
is_expected.to contain_package('python-psycopg2').with(
38+
name: 'python3-psycopg2',
39+
ensure: 'present',
40+
)
41+
}
42+
end
43+
2544
describe 'on a debian based os' do
2645
let :facts do
2746
{

0 commit comments

Comments
 (0)