Showing with 97 additions and 2 deletions.
  1. +12 −0 CHANGELOG.md
  2. +1 −1 manifests/pip.pp
  3. +1 −1 metadata.json
  4. +75 −0 spec/acceptance/pip_spec.rb
  5. +8 −0 spec/defines/pip_spec.rb
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v6.0.1](https://github.com/voxpupuli/puppet-python/tree/v6.0.1) (2021-04-28)

[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.0.0...v6.0.1)

**Fixed bugs:**

- Use $real\_pkgname for pip uninstall command [\#607](https://github.com/voxpupuli/puppet-python/pull/607) ([brabiega](https://github.com/brabiega))

**Closed issues:**

- Pip uninstall does not support pkgname variable [\#606](https://github.com/voxpupuli/puppet-python/issues/606)

## [v6.0.0](https://github.com/voxpupuli/puppet-python/tree/v6.0.0) (2021-04-03)

[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v5.0.0...v6.0.0)
Expand Down
2 changes: 1 addition & 1 deletion manifests/pip.pp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@

default: {
# Anti-action, uninstall.
$command = "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}"
$command = "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${real_pkgname}"
$unless_command = "! ${pip_env} list | grep -i -e '${grep_regex}'"
}
}
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-python",
"version": "6.0.0",
"version": "6.0.1",
"author": "Vox Pupuli",
"summary": "Python Module",
"license": "Apache-2.0",
Expand Down
75 changes: 75 additions & 0 deletions spec/acceptance/pip_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
require 'spec_helper_acceptance'

describe 'python::pip defined resource' do
context 'install package with custom name' do
it 'works with no errors' do
pp = <<-PUPPET
class { 'python':
version => '3',
dev => 'present',
}
python::pyvenv { '/opt/test-venv':
ensure => 'present',
systempkgs => false,
mode => '0755',
pip_version => '<= 20.3.4',
}
python::pip { 'agent package':
virtualenv => '/opt/test-venv',
pkgname => 'agent',
ensure => '0.1.2',
}
PUPPET

apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
end

describe command('/opt/test-venv/bin/pip list') do
its(:exit_status) { is_expected.to eq 0 }
its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} }
end

context 'uninstall package with custom name' do
it 'works with no errors' do
pp = <<-PUPPET
class { 'python':
version => '3',
dev => 'present',
}
python::pyvenv { '/opt/test-venv':
ensure => 'present',
systempkgs => false,
mode => '0755',
pip_version => '<= 20.3.4',
}
python::pip { 'agent package install':
ensure => '0.1.2',
pkgname => 'agent',
virtualenv => '/opt/test-venv',
}
python::pip { 'agent package uninstall custom pkgname':
ensure => 'absent',
pkgname => 'agent',
virtualenv => '/opt/test-venv',
require => Python::Pip['agent package install'],
}
PUPPET

apply_manifest(pp, catch_failures: true)
end
end

describe command('/opt/test-venv/bin/pip list') do
its(:exit_status) { is_expected.to eq 0 }
its(:stdout) { is_expected.not_to match %r{agent.* 0\.1\.2} }
end
end

8 changes: 8 additions & 0 deletions spec/defines/pip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@

it { is_expected.to contain_exec('pip_uninstall_rpyc').with_command(%r{uninstall.*rpyc$}) }
end

context 'passes correct package name' do
let(:params) { { ensure: 'absent', 'pkgname': 'r-pyc' } }

it { is_expected.not_to contain_exec('pip_install_rpyc') }

it { is_expected.to contain_exec('pip_uninstall_rpyc').with_command(%r{uninstall.*r-pyc$}) }
end
end
end
end
Expand Down