Skip to content

Commit

Permalink
FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
smortex committed Dec 14, 2023
1 parent a52b5fa commit 376e7b9
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 9 deletions.
9 changes: 9 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ The following parameters are available in the `python` class:
* [`manage_venv_package`](#-python--manage_venv_package)
* [`manage_pip_package`](#-python--manage_pip_package)
* [`venv`](#-python--venv)
* [`pip_package_name`](#-python--pip_package_name)
* [`gunicorn_package_name`](#-python--gunicorn_package_name)
* [`python_pips`](#-python--python_pips)
* [`python_pyvenvs`](#-python--python_pyvenvs)
Expand Down Expand Up @@ -228,6 +229,14 @@ Data type: `Python::Package::Ensure`

Default value: `'absent'`

##### <a name="-python--pip_package_name"></a>`pip_package_name`

Data type: `Optional[String[1]]`



Default value: `undef`

##### <a name="-python--gunicorn_package_name"></a>`gunicorn_package_name`

Data type: `String[1]`
Expand Down
1 change: 0 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
}
}


contain python::install
contain python::config

Expand Down
2 changes: 1 addition & 1 deletion manifests/install/pip.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
'anaconda': {
}
pip, default: {
'pip', default: {
case $facts['os']['family'] {
'AIX': {
unless String($python::version) =~ /^python3/ {
Expand Down
2 changes: 1 addition & 1 deletion manifests/install/venv.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
include python

# Main python package bundle venv on some operating systems
unless $facts['os']['family'] in ['Archlinux', 'RedHat', 'FreeBSD'] {
unless $facts['os']['family'] in ['Archlinux', 'FreeBSD', 'RedHat'] {
package { 'python-venv':
ensure => $python::venv,
name => "${python::install::python}-venv",
Expand Down
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
}
$manage_venv_package = $facts['os']['family'] ? {
'Archlinux' => false,
'FreeBSD' => false,
'RedHat' => false,
default => true,
}
}
2 changes: 1 addition & 1 deletion spec/classes/install/venv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class { 'python':
PP
end

if %w[Archlinux RedHat FreeBSD].include?(facts[:os]['family'])
if %w[Archlinux FreeBSD RedHat].include?(facts[:os]['family'])
it { is_expected.not_to contain_package('python-venv') }
else
it { is_expected.to contain_package('python-venv').with(ensure: 'present') }
Expand Down
6 changes: 3 additions & 3 deletions spec/classes/install_pip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
context 'when ensuring pip is absent' do
let(:pre_condition) do
<<~PP
class { 'python':
pip => absent,
}
class { 'python':
pip => absent,
}
PP
end

Expand Down
4 changes: 2 additions & 2 deletions spec/classes/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
it { is_expected.to contain_class('python::config') }
it { is_expected.to contain_package('python') }

if facts[:os]['family'] == 'Archlinux'
if %w[Archlinux].include?(facts[:os]['family'])
it { is_expected.not_to contain_class('python::install::pip') }
else
it { is_expected.to contain_class('python::install::pip') }
end

if %w[Archlinux].include?(facts[:os]['family'])
if %w[Archlinux FreeBSD RedHat].include?(facts[:os]['family'])
it { is_expected.not_to contain_class('python::install::venv') }
else
it { is_expected.to contain_class('python::install::venv') }
Expand Down

0 comments on commit 376e7b9

Please sign in to comment.