Skip to content

Commit

Permalink
Merge pull request #628 from yakatz/patch-1
Browse files Browse the repository at this point in the history
RHEL8 has a different package name
  • Loading branch information
bastelfreak authored Nov 16, 2021
2 parents 311ab37 + 117b741 commit 22cd11b
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 2 deletions.
5 changes: 4 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@
}

$gunicorn_package_name = $facts['os']['family'] ? {
'RedHat' => 'python-gunicorn',
'RedHat' => $facts['os']['release']['major'] ? {
'8' => 'python3-gunicorn',
default => 'python-gunicorn',
},
default => 'gunicorn',
}
}
83 changes: 82 additions & 1 deletion spec/classes/python_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'spec_helper'

describe 'python' do
on_supported_os.each do |os, facts|
next if os == 'gentoo-3-x86_64'
Expand Down Expand Up @@ -240,6 +239,88 @@
it { is_expected.to contain_package('python-dev').with_name('python36-devel') }
end
end

describe 'with manage_gunicorn' do
context 'true' do
let(:params) { { manage_gunicorn: true } }

it { is_expected.to contain_package('gunicorn').with_name('python-gunicorn') }
end
context 'empty args' do
# let(:params) {{ :manage_gunicorn => '' }}
it { is_expected.to contain_package('gunicorn').with_name('python-gunicorn') }
end
context 'false' do
let(:params) { { manage_gunicorn: false } }

it { is_expected.not_to contain_package('gunicorn') }
end
end

describe 'with python::provider' do
context 'scl' do
describe 'with version' do
context '3.6 SCL meta package' do
let(:params) { { version: 'rh-python36' } }

it { is_expected.to compile.with_all_deps }
end
context '3.6 SCL python package' do
let(:params) { { version: 'rh-python36-python' } }

it { is_expected.to compile.with_all_deps }
end
end
describe 'with manage_scl' do
context 'true' do
let(:params) { { provider: 'scl', manage_scl: true } }

it { is_expected.to contain_package('centos-release-scl') }
it { is_expected.to contain_package('scl-utils') }
end
context 'false' do
let(:params) { { provider: 'scl', manage_scl: false } }

it { is_expected.not_to contain_package('centos-release-scl') }
it { is_expected.not_to contain_package('scl-utils') }
end
end
end
end
end
when '8'
context 'on a Redhat 8 OS' do
it { is_expected.to contain_class('python::install') }
it { is_expected.to contain_package('pip').with_name('python3-pip') }

describe 'with python::version' do
context 'python36' do
let(:params) { { version: 'python36' } }

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_package('pip').with_name('python36-pip') }
it { is_expected.to contain_package('python').with_name('python36') }
it { is_expected.to contain_package('python-dev').with_name('python36-devel') }
end
end

describe 'with manage_gunicorn' do
context 'true' do
let(:params) { { manage_gunicorn: true } }

it { is_expected.to contain_package('gunicorn').with_name('python3-gunicorn') }
end
context 'empty args' do
# let(:params) {{ :manage_gunicorn => '' }}
it { is_expected.to contain_package('gunicorn').with_name('python3-gunicorn') }
end
context 'false' do
let(:params) { { manage_gunicorn: false } }

it { is_expected.not_to contain_package('gunicorn').with_name('python3-gunicorn') }
end
end

describe 'with python::provider' do
context 'scl' do
describe 'with version' do
Expand Down

0 comments on commit 22cd11b

Please sign in to comment.