From de39e3658daea50a5dc12da85c85bbd1f6872628 Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Wed, 23 Dec 2020 10:41:51 -0500 Subject: [PATCH] Fix pyvenv on some operating systems --- manifests/pyvenv.pp | 9 +++++++++ spec/defines/pyvenv_spec.rb | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 269cf69c..065f85bc 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -49,6 +49,15 @@ ensure_packages($python3_venv_package) Package[$python3_venv_package] -> File[$venv_dir] + + case $facts['os']['distro']['codename'] { + 'buster','bionic': { + $python3_distutils_package = "python${normalized_python_version}-distutils" + ensure_packages($python3_distutils_package) + + Package[$python3_distutils_package] -> File[$venv_dir] + } + } } # pyvenv is deprecated since 3.6 and will be removed in 3.8 diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index 36452839..9492a6f7 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -21,6 +21,10 @@ if %w[xenial bionic cosmic disco stretch buster].include?(facts[:lsbdistcodename]) it { is_expected.to contain_package('python3.5-venv').that_comes_before('File[/opt/env]') } end + + if %w[bionic buster].include?(facts[:lsbdistcodename]) + it { is_expected.to contain_package('python3.5-distutils').that_comes_before('File[/opt/env]') } + end end describe 'when ensure' do