Permalink
Browse files

corrected ensure behavior and allow a real "absent" status

  • Loading branch information...
1 parent 7b9af18 commit 20449d02295ff38c92b1d5b0fe0839a513e3cc22 @cjeanneret cjeanneret committed Oct 29, 2012
Showing with 34 additions and 17 deletions.
  1. +34 −17 manifests/server/install.pp
@@ -4,24 +4,41 @@
$version = "rdiff-backup-${name}"
- archive{"${version}":
- ensure => $ensure,
- checksum => false,
- url => "${params::download_url}${version}.tar.gz",
- target => '/opt/rdiff-backup',
- notify => $ensure ? {
- present => Exec["install ${version}"],
- default => undef
- },
- require => File["/opt/rdiff-backup"],
- }
+ case $ensure {
+ present: {
+ archive{$version:
+ ensure => present,
+ checksum => false,
+ url => "${params::download_url}${version}.tar.gz",
+ target => '/opt/rdiff-backup',
+ notify => Exec["install ${version}"],
+ require => File['/opt/rdiff-backup'],
+ }
+
+ exec {"install ${version}":
+ cwd => "/opt/rdiff-backup/${version}",
+ command => "python setup.py install --prefix=/opt/rdiff-backup/${version}",
+ unless => "test -f /opt/rdiff-backup/${version}/bin/rdiff-backup",
+ refreshonly => true,
+ require => Package['librsync-devel', 'python-devel'],
+ }
+ }
+ absent: {
+ file {"/opt/rdiff-backup/${version}":
+ ensure => absent,
+ backup => false,
+ force => true,
+ recurse => true,
+ }
- exec {"install ${version}":
- cwd => "/opt/rdiff-backup/${version}",
- command => "python setup.py install --prefix=/opt/rdiff-backup/${version}",
- unless => "test -f /opt/rdiff-backup/${version}/bin/rdiff-backup",
- refreshonly => true,
- require => Package["librsync-devel", "python-devel"],
+ file {"/usr/src/${version}.tar.gz":
+ ensure => absent,
+ backup => false,
+ }
+ }
+ default: {
+ fail "Unknown ensure ${ensure} for rdiff-backup::server::install"
+ }
}
}

0 comments on commit 20449d0

Please sign in to comment.