puppet-archive icon indicating copy to clipboard operation
puppet-archive copied to clipboard

Ability to purge the target directory

Open joshuaspence opened this issue 8 years ago • 0 comments

The archive::extract resource from camptocamp/archive contains a purge parameter which can be used to purge the contents of the target directory when extracting an archive. It seems that this module doesn't have a purge parameter. I can work around this by doing the following, but it would obviously be much cleaner if the archive type provided a purge parameter:

  exec { "rm -rf ${extract_path}":
    refreshonly => true,
    before      => File[$extract_path],
    subscribe   => File[$archive_path],
  }

  file { $extract_path:
    ensure => 'directory',
    mode   => '0755',
  }

  archive { $archive_path:
    creates       => "${extract_path}/some_path",
    extract       => true,
    extract_path  => $extract_path,
    subscribe     => File[$archive_path],
  }

joshuaspence avatar Oct 12 '16 01:10 joshuaspence