Skip to content

Commit

Permalink
Implement Ubuntu 20.04 support
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Dec 5, 2020
1 parent 54ca822 commit 276be24
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 39 deletions.
5 changes: 4 additions & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,11 @@
$pip_package = 'pip'
$pip_provider = 'pip'
} else {
$pip_package = fact('os.release.major') ? {
'20.04' => 'python3-pip',
default => 'python-pip',
}
$pip_category = undef
$pip_package = 'python-pip'
$pip_provider = 'pip'
}

Expand Down
6 changes: 5 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
}

$ensure = 'present'
$version = 'system'
$pip = 'present'
$dev = 'absent'
$virtualenv = 'absent'
Expand Down Expand Up @@ -46,4 +45,9 @@
'RedHat' => 'python-gunicorn',
default => 'gunicorn',
}

$version = fact('os.release.major') ? {
'20.04' => '3',
default => 'system',
}
}
3 changes: 2 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"16.04",
"18.04"
"18.04",
"20.04"
]
},
{
Expand Down
1 change: 0 additions & 1 deletion spec/acceptance/facts_test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
context 'facts' do
install_python = <<-EOS
class { 'python' :
version => 'system',
pip => 'present',
virtualenv => 'present',
}
Expand Down
35 changes: 0 additions & 35 deletions spec/acceptance/virtualenv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,12 @@ class { 'python' :

it 'maintains pip version' do
pp = <<-EOS
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
$version = '3'
} else {
$version = 'system'
}
class { 'python' :
version => $version,
pip => 'present',
virtualenv => 'present',
}
-> python::virtualenv { 'venv' :
ensure => 'present',
version => $version,
systempkgs => false,
venv_dir => '/opt/venv2',
}
Expand All @@ -61,19 +54,12 @@ class { 'python' :

it 'works with ensure=>latest' do
pp = <<-EOS
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
$version = '3'
} else {
$version = 'system'
}
class { 'python' :
version => $version,
pip => 'present',
virtualenv => 'present',
}
-> python::virtualenv { 'venv' :
ensure => 'present',
version => $version,
systempkgs => false,
venv_dir => '/opt/venv3',
}
Expand All @@ -92,19 +78,12 @@ class { 'python' :

it 'works with ensure=>latest for package with underscore in its name' do
pp = <<-EOS
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
$version = '3'
} else {
$version = 'system'
}
class { 'python' :
version => $version,
pip => 'present',
virtualenv => 'present',
}
-> python::virtualenv { 'venv' :
ensure => 'present',
version => $version,
systempkgs => false,
venv_dir => '/opt/venv4',
}
Expand All @@ -123,22 +102,15 @@ class { 'python' :

it 'works with editable=>true' do
pp = <<-EOS
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
$version = '3'
} else {
$version = 'system'
}
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 @@ -157,19 +129,12 @@ class { 'python' :

it 'works with == in pkgname' do
pp = <<-EOS
if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' {
$version = '3'
} else {
$version = 'system'
}
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 276be24

Please sign in to comment.