Skip to content

Commit b70d765

Browse files
committed
Closes #3
1 parent e16d34d commit b70d765

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

manifests/install.pp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,27 @@
1111
}
1212

1313
case $ensure {
14-
present: {
14+
present, installed: {
1515
if $version != undef {
1616
$package_with_version = "$package==$version"
17+
$grep_for = "^$package_with_version$"
1718
} else {
1819
$package_with_version = $package
20+
$grep_for = "^$package=="
1921
}
2022

2123
exec { "install-$package":
2224
command => "pip$python_version install $package_with_version",
23-
unless => "pip$python_version freeze | grep '^$package_with_version$'",
25+
unless => "pip$python_version freeze | grep '$grep_for'",
2426
}
2527
}
2628

27-
absent: {
29+
latest: {
30+
# TODO Read from https://pypi.python.org/pypi/<package_name>/json
31+
# Probably best if implemented in Ruby
32+
}
33+
34+
absent, purged: {
2835
exec { "uninstall-$package":
2936
command => "pip$python_version uninstall $package -y",
3037
onlyif => "pip$python_version freeze | cut -d= -f1 | egrep '^$package$'",

0 commit comments

Comments
 (0)