From 22c1409540b76572ba5603fb99e725068eb5b9e7 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 15 Dec 2020 11:27:33 +0100 Subject: [PATCH] Set default python to 3 --- REFERENCE.md | 10 ++++++---- manifests/init.pp | 2 +- manifests/params.pp | 8 -------- manifests/pyvenv.pp | 2 +- manifests/virtualenv.pp | 2 +- spec/acceptance/pyvenv_spec.rb | 2 +- spec/acceptance/virtualenv_spec.rb | 21 --------------------- 7 files changed, 10 insertions(+), 37 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index d08c17ac..4681ce00 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -90,7 +90,7 @@ Allowed values: - 3/3.3/... means you are going to install the python3/python3.3/... package, if available on your osfamily. -Default value: `$python::params::version` +Default value: `'3'` ##### `pip` @@ -824,7 +824,7 @@ Data type: `Python::Version` Python version to use. -Default value: `'system'` +Default value: `'3'` ##### `systempkgs` @@ -1060,7 +1060,7 @@ Data type: `Python::Version` Python version to use. -Default value: `'system'` +Default value: `'3'` ##### `requirements` @@ -1099,6 +1099,8 @@ Default value: ``true`` Data type: `Boolean` Include distribute in the virtualenv +Forced to `false` for Ubuntu 18.04 and 20.04 +Forced to `false` for RedHat based systems Default value: ``true`` @@ -1192,7 +1194,7 @@ Default value: `''` ##### `virtualenv` -Data type: `Optional[Stdlib::Absolutepath]` +Data type: `Optional[String[1]]` diff --git a/manifests/init.pp b/manifests/init.pp index 74c13d66..728cb07e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -37,7 +37,7 @@ # class python ( Python::Package::Ensure $ensure = $python::params::ensure, - Python::Version $version = $python::params::version, + Python::Version $version = '3', Python::Package::Ensure $pip = $python::params::pip, Python::Package::Ensure $dev = $python::params::dev, Python::Package::Ensure $virtualenv = $python::params::virtualenv, diff --git a/manifests/params.pp b/manifests/params.pp index 89a5ccce..e1ed7c21 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -45,12 +45,4 @@ 'RedHat' => 'python-gunicorn', default => 'gunicorn', } - - if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8' { - $version = '3' - } elsif $facts['os']['release']['major'] == '20.04' { - $version = '3' - } else { - $version = 'system' - } } diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 1f1dd573..0115111e 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -23,7 +23,7 @@ # define python::pyvenv ( Python::Package::Ensure $ensure = present, - Python::Version $version = 'system', + Python::Version $version = '3', Boolean $systempkgs = false, Stdlib::Absolutepath $venv_dir = $name, String[1] $owner = 'root', diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index d4c8228d..939a6930 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -35,7 +35,7 @@ # define python::virtualenv ( Python::Package::Ensure $ensure = 'present', - Python::Version $version = 'system', + Python::Version $version = '3', Variant[Boolean,Stdlib::Absolutepath] $requirements = false, Boolean $systempkgs = false, Stdlib::Absolutepath $venv_dir = $name, diff --git a/spec/acceptance/pyvenv_spec.rb b/spec/acceptance/pyvenv_spec.rb index f648fa31..c137d0b9 100644 --- a/spec/acceptance/pyvenv_spec.rb +++ b/spec/acceptance/pyvenv_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper_acceptance' -describe 'python::pyvenv defined resource' do +describe 'python::pyvenv defined resource with python 3' do context 'minimal parameters' do # Using puppet_apply as a helper it 'works with no errors' do diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb index ca8d91b2..e51e8640 100644 --- a/spec/acceptance/virtualenv_spec.rb +++ b/spec/acceptance/virtualenv_spec.rb @@ -5,16 +5,12 @@ # Using puppet_apply as a helper it 'works with no errors' do pp = <<-EOS - $version = '3' - class { 'python' : - version => $version, pip => 'present', virtualenv => 'present', } -> python::virtualenv { 'venv' : ensure => 'present', - version => $version, systempkgs => false, distribute => false, venv_dir => '/opt/venv', @@ -32,16 +28,12 @@ class { 'python' : it 'maintains pip version' do pp = <<-EOS - $version = '3' - class { 'python' : - version => $version, pip => 'present', virtualenv => 'present', } -> python::virtualenv { 'venv' : ensure => 'present', - version => $version, systempkgs => false, venv_dir => '/opt/venv2', } @@ -58,16 +50,12 @@ class { 'python' : it 'works with ensure=>latest' do pp = <<-EOS - $version = '3' - class { 'python' : - version => $version, pip => 'present', virtualenv => 'present', } -> python::virtualenv { 'venv' : ensure => 'present', - version => $version, systempkgs => false, venv_dir => '/opt/venv3', } @@ -86,7 +74,6 @@ class { 'python' : it 'works with ensure=>latest for package with underscore in its name' do pp = <<-EOS - $version = '3' class { 'python' : version => $version, @@ -114,19 +101,15 @@ class { 'python' : it 'works with editable=>true' do pp = <<-EOS - $version = '3' - package{ 'git' : ensure => 'present', } -> class { 'python' : - version => $version, pip => 'present', virtualenv => 'present', } -> python::virtualenv { 'venv' : ensure => 'present', - version => $version, systempkgs => false, venv_dir => '/opt/venv5', } @@ -145,16 +128,12 @@ class { 'python' : it 'works with == in pkgname' do pp = <<-EOS - $version = '3' - class { 'python' : - version => $version, pip => 'present', virtualenv => 'present', } -> python::virtualenv { 'venv' : ensure => 'present', - version => $version, systempkgs => false, venv_dir => '/opt/venv6', }