We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cebe07b commit decf2b0Copy full SHA for decf2b0
1 file changed
manifests/install.pp
@@ -0,0 +1,34 @@
1
+
2
+define pip::install(
3
+ $package = $title,
4
+ $version = undef,
5
+ $python_version = '2.7',
6
+ $ensure = present,
7
+) {
8
9
+ Exec {
10
+ path => ['/usr/local/bin', '/usr/bin', '/bin'],
11
+ }
12
13
+ case $ensure {
14
+ present: {
15
+ if $version != undef {
16
+ $package_with_version = "$package==$version"
17
+ } else {
18
+ $package_with_version = $package
19
20
21
+ exec { "install-$package":
22
+ command => "pip$python_version install $package_with_version",
23
+ unless => "pip$python_version freeze | grep '^$package_with_version$'",
24
25
26
27
+ absent: {
28
+ exec { "uninstall-$package":
29
+ command => "pip$python_version uninstall $package -y",
30
+ onlyif => "pip$python_version freeze | cut -d= -f1 | egrep '^$package$'",
31
32
33
34
+}
0 commit comments