archive
Version information
This version is compatible with:
- Puppet Enterprise 3.x
- Puppet >=2.7.0
- , , , , , , , , ,
This module has been deprecated by its author since May 18th 2021.
The author has suggested puppet-archive as its replacement.
Start using this module
Documentation
Puppet Archive
Warning
Release 0.3.x contains breaking changes
- The parameter 7zip have been changed to seven_zip to conform to Puppet 4.x variable name requirements.
- The namevar name have been changed to path to allow files with the same filename to exists in different filepath.
Table of Contents
Overview
This module manages download and deployment of archive files.
Module Description
This module uses types and providers to download and manage compress files, with optional lifecycle functionality such as checksum, extraction, and cleanup. The benefits over existing modules such as puppet-staging:
- Implemented via types and provider instead of exec resource.
- Follows 302 redirect and propagate download failure.
- Optional checksum verification of archive files.
- Automatic dependency to parent directory.
- Support Windows file extraction via 7zip.
- Able to cleanup archive files after extraction.
Setup
The module requires faraday/faraday_middleware gems on the puppet master, which are typically present because they are a dependency of r10k. This dependency is managed by specifying 'include ::archive'.
Usage
include 'archive'
archive { '/tmp/jta-1.1.jar':
ensure => present,
extract => true,
extract_path => '/tmp',
source => 'http://central.maven.org/maven2/javax/transaction/jta/1.1/jta-1.1.jar',
checksum => '2ca09f0b36ca7d71b762e14ea2ff09d5eac57558',
checksum_type => 'sha1',
creates => '/tmp/javax',
cleanup => true,
}
archive { '/tmp/test100k.db':
source => 'ftp://ftp.otenet.gr/test100k.db',
username => 'speedtest',
password => 'speedtest',
}
archive { '/tmp/test.zip':
# NOTE: a copy will be created if source is different from archive path
source => 'file:///vagrant/files/test.zip',
extract => true,
extract_path => '/tmp',
}
Archive module dependency is managed by the archive class. By default 7zip is installed via chocolatey, but can be adjusted to use the msi package instead:
class { 'archive':
seven_zip_name => '7-Zip 9.20 (x64 edition)',
seven_zip_source => 'C:/Windows/Temp/7z920-x64.msi',
seven_zip_provider => 'windows',
}
Reference
Classes
archive
: install faraday/faraday_middleware gem, and 7zip package (Windows only).archive::staging
: install gem/package dependencies and creates staging directory for backwards compatibility. Use the archive class instead if you do not need the staging directory.
Define Resources
archive::artifactory
: archive wrapper for JFrog Artifactory files with checksum.archive::go
: archive wrapper for GO Continuous Delivery files with checksum.
Resources
Archive
ensure
: whether archive file should be present/absent (default: present)path
: namevar, archive file fully qualified file path.filename
: archive file name (derived from path).source
: archive file source, supports http|https|ftp|file uri.username
: username to download source file.password
: password to download source file.cookie
: archive file download cookie.checksum_type
archive file checksum type (none|md5|sha1|sha2|sh256|sha384|sha512). (default: none)checksum
: archive file checksum (match checksum_type)checksum_source
: archive file checksum source (instead of specify checksum)checksum_verify
: whether checksum be verified (true|false). (default: true)extract
: whether archive be extracted after download (true|false). (default: false)extract_path
: target folder path to extract archive.extract_command
: custom extraction command ('tar xvf example.tar.gz'), also support sprintf format ('tar xvf %s') which will be processed with the filename: sprintf('tar xvf %s', filename)extract_flags
: custom extraction options, this replaces the default flags. A string such as 'xvf' for a tar file would replace the default xf flag. A hash is useful when custom flags are needed for different platforms. {'tar' => 'xzf', '7z' => 'x -aot'}.user
: extract command user (using this option will configure the archive file permission to 0644 so the user can read the file).group
: extract command group (using this option will configure the archive file permisison to 0644 so the user can read the file).cleanup
: whether archive file be removed after extraction (true|false). (default: true)creates
: if file/directory exists, will not download/extract archive.
Example:
archive { '/tmp/jta-1.1.jar':
ensure => present,
source => 'http://central.maven.org/maven2/javax/transaction/jta/1.1/jta-1.1.jar',
checksum => '2ca09f0b36ca7d71b762e14ea2ff09d5eac57558',
checksum_type => 'sha1',
extract => true,
extract_path => '/tmp',
creates => '/tmp/javax',
cleanup => true,
}
Limitations
The archive::artifactory and archive::go resource need the faraday_middleware gem, and network access to the artifactory/go server to obtain the archive checksum. This gem is installed as a dependency for r10k, or otherwise this dependency should be installed as part of the puppet master initial deployment and configuration.
Types in this module release
##2015/4/23 - 0.3.0
- Fix Puppet 4 compatability issues
- Fix archive namevar to use path
##2015/3/5 - 0.2.2
- add FTP and File support
##2015/2/26 - 0.2.1
- fix ruby 1.8.7 syntax error
##2015/2/23 - 0.2.0
- fix custom flags options
- add msi installation option for 7zip
- add support for configuring extract command user/group
- use temporary filepath for download
##2014/12/08 - 0.1.8
- Update documentation
- puppet-lint, metadata.json cleanup
##2014/11/13 - 0.1.7
- Fix Puppet Enterprise detection
- Fix checksum length restriction
- Add puppetlabs stdlib/pe_gem dependency
- Add spec testing
##2014/11/05 - 0.1.6
- Fix Windows SSL authentication issues
##2014/11/04 - 0.1.5
- Add cookie support
##2014/10/03 - 0.1.4
- Fix file overwrite and re-extract
##2014/10/03 - 0.1.3
- Fix windows x86 path bug
##2014/10/02 - 0.1.2
- Fix autorequire and installation of dependencies
##2014/10/01 - 0.1.1
- Add windows extraction support via 7zip
##2014/9/26 - 0.1.0
- Initial Release
Dependencies
- puppetlabs/stdlib (>= 2.2.1)
- puppetlabs/pe_gem (>= 0.0.1)
Copyright (c) 2014 Bodeco Inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.