Showing with 14 additions and 7 deletions.
  1. +1 −1 Modulefile
  2. +13 −6 manifests/pip.pp
2 changes: 1 addition & 1 deletion Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'stankevich-python'
version '1.6.5'
version '1.6.6'

author 'Sergey Stankevich'
license 'Apache License, Version 2.0'
Expand Down
19 changes: 13 additions & 6 deletions manifests/pip.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
#
# === Parameters
#
# [*name]
# must be unique
#
# [*pkgname]
# name of the package.
#
# [*ensure*]
# present|absent. Default: present
#
Expand Down Expand Up @@ -35,6 +41,7 @@
# Fotis Gimian
#
define python::pip (
$pkgname = undef,
$ensure = present,
$virtualenv = 'system',
$url = false,
Expand Down Expand Up @@ -70,18 +77,18 @@
default => "--proxy=${proxy}",
}

$grep_regex = $name ? {
/==/ => "^${name}\$",
default => "^${name}==",
$grep_regex = $pkgname ? {
/==/ => "^${pkgname}\$",
default => "^${pkgname}==",
}

$egg_name = $egg ? {
false => $name,
false => $pkgname,
default => $egg
}

$source = $url ? {
false => $name,
false => $pkgname,
default => "${url}#egg=${egg_name}",
}

Expand Down Expand Up @@ -122,7 +129,7 @@

default: {
exec { "pip_uninstall_${name}":
command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}",
command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${pkgname}",
onlyif => "${pip_env} freeze | grep -i -e ${grep_regex}",
user => $owner,
environment => $environment,
Expand Down