diff --git a/manifests/install.pp b/manifests/install.pp index 56ce36ce..66fc13cb 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -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' } diff --git a/manifests/params.pp b/manifests/params.pp index 338f9bd9..c28bc7cb 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -10,7 +10,6 @@ } $ensure = 'present' - $version = 'system' $pip = 'present' $dev = 'absent' $virtualenv = 'absent' @@ -46,4 +45,9 @@ 'RedHat' => 'python-gunicorn', default => 'gunicorn', } + + $version = fact('os.release.major') ? { + '20.04' => '3', + default => 'system', + } } diff --git a/metadata.json b/metadata.json index 69895173..301a05cc 100644 --- a/metadata.json +++ b/metadata.json @@ -42,7 +42,8 @@ "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "16.04", - "18.04" + "18.04", + "20.04" ] }, { diff --git a/spec/acceptance/facts_test_spec.rb b/spec/acceptance/facts_test_spec.rb index 39c1ad83..ce5b2cfa 100644 --- a/spec/acceptance/facts_test_spec.rb +++ b/spec/acceptance/facts_test_spec.rb @@ -4,7 +4,6 @@ context 'facts' do install_python = <<-EOS class { 'python' : - version => 'system', pip => 'present', virtualenv => 'present', } diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb index 13e5888d..c95fa00a 100644 --- a/spec/acceptance/virtualenv_spec.rb +++ b/spec/acceptance/virtualenv_spec.rb @@ -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', } @@ -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', } @@ -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', } @@ -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', } @@ -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', }