From c76c9b4dd8933ec0608cc34166fc4e87653e5579 Mon Sep 17 00:00:00 2001 From: Vincent Brillault Date: Fri, 7 Sep 2018 09:38:59 +0200 Subject: [PATCH 1/3] Acceptance test: Install pip First part of regression test for PR#418 --- spec/acceptance/virtualenv_spec.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb index ccf6a3f0..b1a83b02 100644 --- a/spec/acceptance/virtualenv_spec.rb +++ b/spec/acceptance/virtualenv_spec.rb @@ -29,5 +29,30 @@ class { 'python' : apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) end + it 'maintains pip version' do + pp = <<-EOS + class { 'python' : + version => 'system', + pip => 'present', + virtualenv => 'present', + } + -> + python::virtualenv { 'venv' : + ensure => 'present', + systempkgs => false, + venv_dir => '/opt/venv2', + owner => 'root', + group => 'root', + } + -> + python::pip { 'pip' : + ensure => '18.0', + virtualenv => '/opt/venv2', + } + EOS + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + end end end From bbb85bf0f4cf34112adae0c89b527168bef53e38 Mon Sep 17 00:00:00 2001 From: Vincent Brillault Date: Fri, 7 Sep 2018 12:41:17 +0200 Subject: [PATCH 2/3] Acceptance test: check if pip installation is idempotent Second part of regression test for PR#418 --- spec/acceptance/virtualenv_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb index b1a83b02..5412bee3 100644 --- a/spec/acceptance/virtualenv_spec.rb +++ b/spec/acceptance/virtualenv_spec.rb @@ -53,6 +53,7 @@ class { 'python' : # Run it twice and test for idempotency apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) end end end From 3c3ba036e594b514fcf8e3f134be726ec3c695c9 Mon Sep 17 00:00:00 2001 From: Vincent Brillault Date: Thu, 26 Jul 2018 08:48:21 +0200 Subject: [PATCH 3/3] Pip: freeze all to be able to control setuptools, distribute, wheel, pip By default `pip freeze` skip the mentioned packages and only displays their version if `--all` is used --- manifests/pip.pp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 755081a3..e7aa6efe 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -215,7 +215,7 @@ if $ensure != present and $ensure != latest { exec { "pip_install_${name}": command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}@${ensure}#egg=${egg_name} || ${pip_install} ${install_args} ${pip_common_args}@${ensure}#egg=${egg_name} ;}", - unless => "${pip_env} freeze | grep -i -e ${grep_regex}", + unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}", user => $owner, group => $group, umask => $umask, @@ -227,7 +227,7 @@ } else { exec { "pip_install_${name}": command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${install_args} ${pip_common_args} ;}", - unless => "${pip_env} freeze | grep -i -e ${grep_regex}", + unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}", user => $owner, group => $group, umask => $umask, @@ -244,7 +244,7 @@ # Explicit version. exec { "pip_install_${name}": command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}==${ensure} || ${pip_install} ${install_args} ${pip_common_args}==${ensure} ;}", - unless => "${pip_env} freeze | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", + unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, group => $group, umask => $umask, @@ -259,7 +259,7 @@ # Whatever version is available. exec { "pip_install_${name}": command => "${wheel_check} ; { ${pip_install} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${pip_common_args} ;}", - unless => "${pip_env} freeze | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", + unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, group => $group, umask => $umask, @@ -289,7 +289,7 @@ # Anti-action, uninstall. exec { "pip_uninstall_${name}": command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}", - onlyif => "${pip_env} freeze | grep -i -e ${grep_regex}", + onlyif => "${pip_env} freeze --all | grep -i -e ${grep_regex}", user => $owner, group => $group, umask => $umask,