Skip to content

Commit

Permalink
Set default python to 3
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Dec 15, 2020
1 parent d9c51a8 commit 22c1409
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 37 deletions.
10 changes: 6 additions & 4 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -824,7 +824,7 @@ Data type: `Python::Version`

Python version to use.

Default value: `'system'`
Default value: `'3'`

##### `systempkgs`

Expand Down Expand Up @@ -1060,7 +1060,7 @@ Data type: `Python::Version`

Python version to use.

Default value: `'system'`
Default value: `'3'`

##### `requirements`

Expand Down Expand Up @@ -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``

Expand Down Expand Up @@ -1192,7 +1194,7 @@ Default value: `''`

##### `virtualenv`

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



Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 0 additions & 8 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
2 changes: 1 addition & 1 deletion manifests/pyvenv.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion manifests/virtualenv.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/pyvenv_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
21 changes: 0 additions & 21 deletions spec/acceptance/virtualenv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
}
Expand All @@ -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',
}
Expand All @@ -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,
Expand Down Expand Up @@ -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',
}
Expand All @@ -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',
}
Expand Down

0 comments on commit 22c1409

Please sign in to comment.