Skip to content

Commit

Permalink
Merge pull request #497 from syseleven/fix_reassigned_variable
Browse files Browse the repository at this point in the history
Fix a reassigned variable
  • Loading branch information
baurmatt authored Nov 26, 2019
2 parents 734acec + 94d6218 commit 432708e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 6 additions & 4 deletions manifests/pip.pp
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@
$pip_install = "${pip_env} --log ${log}/pip.log install"
$pip_common_args = "${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}"

$pip_exec_name = "pip_install_${name}"

# Explicit version out of VCS when PIP supported URL is provided
if $source =~ /^'(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+'$/ {
if $_ensure != present and $_ensure != latest {
Expand Down Expand Up @@ -221,14 +219,18 @@

default: {
# Anti-action, uninstall.
$pip_exec_name = "pip_uninstall_${name}"
$command = "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}"
$unless_command = "! ${pip_env} list | grep -i -e '${grep_regex}'"
}
}
}

exec { $pip_exec_name:
$pip_installer = ($ensure == 'absent') ? {
true => "pip_uninstall_${name}",
false => "pip_install_${name}",
}

exec { $pip_installer:
command => $command,
unless => $unless_command,
user => $owner,
Expand Down
10 changes: 10 additions & 0 deletions spec/defines/pip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@
it { is_expected.to contain_exec('pip_install_rpyc').with_unless(%r{wordpress-json}) }
end
end

describe 'uninstall' do
context 'adds correct title' do
let(:params) { { ensure: 'absent' } }

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

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

Expand Down

0 comments on commit 432708e

Please sign in to comment.