cookbook 'archive', '= 1.0.0'
archive (8) Versions 1.0.0 Follow6
Provides utility to download and unpack archives.
cookbook 'archive', '= 1.0.0', :supermarket
knife supermarket install archive
knife supermarket download archive
Description
Provides a utility LWRP to retrieve versioned archives and unpack them in a local versioned directory.
Requirements
Platform:
- Ubuntu
- Debian
- Windows
Cookbooks:
- cutlery
- zipfile
Attributes
No attributes defined
Recipes
No recipes defined
Resources
- archive - The LWRP retrieves an artifact of particular version from a url.
archive
The LWRP retrieves an artifact of particular version from a url. The artifact is
placed in a versioned directory and then a symlink is created from current version
of the artifact to the retrieved version.
The LWRP first creates a container directory based on the name and the prefix. Under the
container directory, there is a directory in which all the versions of the artifact are
stored. The LWRP will download the artifact and place it in this directory and then symlink
the "current" directory to the downloaded artifact.
By default the LWRP will retain the directory for the last artifact downloaded.
Actions
- add: Download and extract archive. Default action.
Attribute Parameters
- name: The logical name of the artifact. Used when creating the container directory.
- url: The url from which to download the resource.
- version: The version of the archive. Should be set, otherwise will be derived as a hash of the url parameter. Defaults to <code>nil</code>.
- owner: The owner of the container directory and created artifacts. Defaults to <code>"root"</code>.
- group: The group of the container directory and created artifacts. Defaults to <code>0</code>.
- mode: The permissions on the container directory and created artifacts. Defaults to <code>"0700"</code>.
- umask: The umask used when setting up the archive. Defaults to <code>nil</code>.
- prefix: The directory in which the archive is unpacked. Defaults to <code>nil</code>.
- extract_action: The action to take with the downloaded archive. Defaults to leaving the archive un-extracted but can also unzip or unzip and strip the first directory. Defaults to <code>nil</code>.
Examples
# Download the myapp.zip archive, extract the archive, strip the
# top level dir and place results into /usr/local/myapp/versions/1.0
# and symlink /usr/local/myapp/versions/current to /usr/local/myapp/versions/1.0
archive 'myapp' do
url "http://example.com/myapp.zip"
version '1.0'
owner 'myapp'
group 'myapp'
extract_action 'unzip_and_strip_dir'
end
# Download the myapp.zip archive, extract the archive, strip the
# top level dir and place results into /usr/loca/myapp/versions/1.0
# and symlink /usr/local/myapp/versions/current to /usr/local/myapp/versions/1.0
# and set the permissions of /usr/local/myapp to 0755
archive 'myapp' do
url "http://example.com/myapp.zip"
version '1.0'
owner 'myapp'
group 'myapp'
mode '0755'
extract_action 'unzip_and_strip_dir'
end
# Download the myapp.jar and place set the attribute
# myapp.home_dir to the container dir (i.e. /usr/local/myapp) and
# myapp.jar_location to the downloaded jar. (i.e. /usr/local/myapp/pkg/current/myapp-1.0.jar)
archive 'myapp' do
url "http://example.com/myapp.jar"
version '1.0'
owner 'myapp'
group 'myapp'
end
License and Maintainer
Maintainer:: Peter Donald (peter@realityforge.org)
License:: Apache 2.0
v1.0.0:
- Fix umask nil attribute
- Drop support for Chef version 13 and below.
- Style fixes
v0.4.1:
- Change unzip package dependency to ruby native implementation Submitted by Tero Pihlaja
v0.4.0:
- Add Windows support for unzip_and_strip_dir extract action Submitted by Tero Pihlaja
- Fix some style issues Submitted by Tero Pihlaja
v0.2.10:
v0.2.8:
- Makes the permissions on the container directory configurable by adding a mode attribute in the LWRP. This will apply to the top level container directory, e.g. /usr/local/myapp and the version subdirectories /usr/local/myapp/versions and /usr/local/myapp/versions/x.x.x. Submitted by Daniel van den Berg.
v0.2.6:
- Keep the latest 4 versions of file.
- Delete the oldest versions rather than the earliest.
- Avoid linking on windows at all until the link resource can correctly handle changes of the target.
v0.2.4:
- Initial windows support. Does not yet handle rights controls, nor does it support specifying an extraction action.
- Recursively create the base directory.
- Remove the publish_container_dir_to and publish_artifact_location_to LWRP parameters in favour of explicitly retrieving the values through the methods on the resource.
- Keep two versions of the artifact in the versioned folder. Older artifacts, based on creation time are removed.
- Stop backing up deleted files.
- Support file:// urls.
v0.2.1:
- Initial external release.
Collaborator Number Metric
1.0.0 failed this metric
Failure: Cookbook has 1 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
1.0.0 passed this metric
Foodcritic Metric
1.0.0 failed this metric
FC021: Resource condition in provider may not behave as expected: archive/providers/default.rb:46
Run with Foodcritic Version 14.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
1.0.0 passed this metric
Testing File Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.0.0 passed this metric
1.0.0 failed this metric
1.0.0 passed this metric
Foodcritic Metric
1.0.0 failed this metric
FC021: Resource condition in provider may not behave as expected: archive/providers/default.rb:46
Run with Foodcritic Version 14.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
1.0.0 passed this metric
Testing File Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.0.0 passed this metric
1.0.0 failed this metric
Run with Foodcritic Version 14.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
1.0.0 passed this metric
Testing File Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.0.0 passed this metric
1.0.0 failed this metric
1.0.0 passed this metric