From 5c703a5318ce5a43dc29f598569cf85d0bfd8792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Thu, 14 Dec 2023 06:48:05 -1000 Subject: [PATCH] FIX --- REFERENCE.md | 9 +++++++++ manifests/init.pp | 1 - manifests/install/pip.pp | 2 +- manifests/install/venv.pp | 2 +- manifests/params.pp | 2 ++ spec/classes/install/venv_spec.rb | 2 +- spec/classes/install_pip_spec.rb | 6 +++--- spec/classes/python_spec.rb | 4 ++-- 8 files changed, 19 insertions(+), 9 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 533d8d25..63f040b5 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -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) @@ -228,6 +229,14 @@ Data type: `Python::Package::Ensure` Default value: `'absent'` +##### `pip_package_name` + +Data type: `Optional[String[1]]` + + + +Default value: `undef` + ##### `gunicorn_package_name` Data type: `String[1]` diff --git a/manifests/init.pp b/manifests/init.pp index b681e7a2..57b5e0dc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -76,7 +76,6 @@ } } - contain python::install contain python::config diff --git a/manifests/install/pip.pp b/manifests/install/pip.pp index 18b11468..14c19192 100644 --- a/manifests/install/pip.pp +++ b/manifests/install/pip.pp @@ -15,7 +15,7 @@ } 'anaconda': { } - pip, default: { + 'pip', default: { case $facts['os']['family'] { 'AIX': { unless String($python::version) =~ /^python3/ { diff --git a/manifests/install/venv.pp b/manifests/install/venv.pp index 1b35479a..c0d0abb4 100644 --- a/manifests/install/venv.pp +++ b/manifests/install/venv.pp @@ -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", diff --git a/manifests/params.pp b/manifests/params.pp index 49bfdeac..c61b1b5d 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -40,6 +40,8 @@ } $manage_venv_package = $facts['os']['family'] ? { 'Archlinux' => false, + 'FreeBSD' => false, + 'RedHat' => false, default => true, } } diff --git a/spec/classes/install/venv_spec.rb b/spec/classes/install/venv_spec.rb index 554559b5..ceaae979 100644 --- a/spec/classes/install/venv_spec.rb +++ b/spec/classes/install/venv_spec.rb @@ -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') } diff --git a/spec/classes/install_pip_spec.rb b/spec/classes/install_pip_spec.rb index 458a68a6..fc67d6c6 100644 --- a/spec/classes/install_pip_spec.rb +++ b/spec/classes/install_pip_spec.rb @@ -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 diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 8f43560c..0e47bf00 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -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 CentOS].include?(facts[:os]['family']) it { is_expected.not_to contain_class('python::install::venv') } else it { is_expected.to contain_class('python::install::venv') }