summaryrefslogtreecommitdiff
path: root/manifests/pip.pp
diff options
context:
space:
mode:
authorJarl Stefansson <jarl@sdelements.com>2013-12-13 15:51:45 -0500
committerJarl Stefansson <jarl@sdelements.com>2013-12-13 15:51:45 -0500
commit6c6d58a0f3f286ae7994cc54c05416c7efd6b87a (patch)
tree195a672b6a550b7735c81db9b1db5d72c88c1f1d /manifests/pip.pp
parentf7801a4b0d9ae58187891d124c21d269eae19ba5 (diff)
parent44ea60543b37ce5ddb9ff9b7411dbf7a0330f0e6 (diff)
Merge branch 'master' of github.com:jalli/puppet-python
Conflicts: manifests/pip.pp manifests/requirements.pp manifests/virtualenv.pp
Diffstat (limited to 'manifests/pip.pp')
-rw-r--r--manifests/pip.pp34
1 files changed, 25 insertions, 9 deletions
diff --git a/manifests/pip.pp b/manifests/pip.pp
index 0bed6dc..bcb7911 100644
--- a/manifests/pip.pp
+++ b/manifests/pip.pp
@@ -35,12 +35,15 @@
# Fotis Gimian
#
define python::pip (
- $ensure = present,
- $virtualenv = 'system',
- $url = false,
- $owner = 'root',
- $proxy = false,
- $environment = []
+ $ensure = present,
+ $virtualenv = 'system',
+ $url = false,
+ $owner = 'root',
+ $proxy = false,
+ $egg = false,
+ $environment = [],
+ $install_args = '',
+ $uninstall_args = '',
) {
# Parameter validation
@@ -72,15 +75,20 @@ define python::pip (
default => "^${name}==",
}
+ $egg_name = $egg ? {
+ false => $name,
+ default => $egg
+ }
+
$source = $url ? {
false => $name,
- default => "${url}#egg=${name}",
+ default => "${url}#egg=${egg_name}",
}
case $ensure {
present: {
exec { "pip_install_${name}":
- command => "$pip_env --log ${cwd}/pip.log install ${proxy_flag} ${source}",
+ command => "$pip_env --log ${cwd}/pip.log install $install_args ${proxy_flag} ${source}",
unless => "$pip_env freeze | grep -i -e ${grep_regex}",
user => $owner,
environment => $environment,
@@ -97,9 +105,17 @@ define python::pip (
}
}
+ latest: {
+ exec { "pip_install_${name}":
+ command => "$pip_env --log ${cwd}/pip.log install -U $install_args ${proxy_flag} ${source}",
+ user => $owner,
+ environment => $environment,
+ }
+ }
+
default: {
exec { "pip_uninstall_${name}":
- command => "echo y | $pip_env uninstall ${proxy_flag} ${name}",
+ command => "echo y | $pip_env uninstall $uninstall_args ${proxy_flag} ${name}",
onlyif => "$pip_env freeze | grep -i -e ${grep_regex}",
user => $owner,
environment => $environment,