Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #11 from cjeanneret/install-ensure-absent

corrected ensure behavior and allow a real "absent" status
  • Loading branch information...
commit ddaf78bae8e09833f21275a8e778e2cdb26beeb2 2 parents 7b9af18 + 20449d0
Jeanneret Cedric authored December 14, 2012

Showing 1 changed file with 34 additions and 17 deletions. Show diff stats Hide diff stats

  1. 51  manifests/server/install.pp
51  manifests/server/install.pp
@@ -4,24 +4,41 @@
4 4
 
5 5
   $version = "rdiff-backup-${name}"
6 6
 
7  
-  archive{"${version}":
8  
-    ensure   => $ensure,
9  
-    checksum => false,
10  
-    url      => "${params::download_url}${version}.tar.gz",
11  
-    target   => '/opt/rdiff-backup',
12  
-    notify   => $ensure ? {
13  
-      present => Exec["install ${version}"],
14  
-      default => undef
15  
-    },
16  
-    require  => File["/opt/rdiff-backup"],
17  
-  }
  7
+  case $ensure {
  8
+    present: {
  9
+      archive{$version:
  10
+        ensure   => present,
  11
+        checksum => false,
  12
+        url      => "${params::download_url}${version}.tar.gz",
  13
+        target   => '/opt/rdiff-backup',
  14
+        notify   => Exec["install ${version}"],
  15
+        require  => File['/opt/rdiff-backup'],
  16
+      }
  17
+
  18
+      exec {"install ${version}":
  19
+        cwd         => "/opt/rdiff-backup/${version}",
  20
+        command     => "python setup.py install --prefix=/opt/rdiff-backup/${version}",
  21
+        unless      => "test -f /opt/rdiff-backup/${version}/bin/rdiff-backup",
  22
+        refreshonly => true,
  23
+        require     => Package['librsync-devel', 'python-devel'],
  24
+      }
  25
+    }
  26
+    absent: {
  27
+      file {"/opt/rdiff-backup/${version}":
  28
+        ensure  => absent,
  29
+        backup  => false,
  30
+        force   => true,
  31
+        recurse => true,
  32
+      }
18 33
 
19  
-  exec {"install ${version}":
20  
-    cwd         => "/opt/rdiff-backup/${version}",
21  
-    command     => "python setup.py install --prefix=/opt/rdiff-backup/${version}",
22  
-    unless      => "test -f /opt/rdiff-backup/${version}/bin/rdiff-backup",
23  
-    refreshonly => true,
24  
-    require     => Package["librsync-devel", "python-devel"],
  34
+      file {"/usr/src/${version}.tar.gz":
  35
+        ensure => absent,
  36
+        backup => false,
  37
+      }
  38
+    }
  39
+    default: {
  40
+      fail "Unknown ensure ${ensure} for rdiff-backup::server::install"
  41
+    }
25 42
   }
26 43
 
27 44
 }

0 notes on commit ddaf78b

Please sign in to comment.
Something went wrong with that request. Please try again.