Skip to content

Latest commit

 

History

History
1157 lines (621 loc) · 25.9 KB

REFERENCE.md

File metadata and controls

1157 lines (621 loc) · 25.9 KB

Reference

Table of Contents

Classes

Public Classes

  • archive: Manages archive module's dependencies.
  • archive::staging: Backwards-compatibility class for staging module

Private Classes

  • archive::params: OS specific archive settings such as default user and file mode.

Defined types

Resource types

  • archive: Manage archive file download, extraction, and cleanup.

Functions

Public Functions

Private Functions

  • archive::assemble_nexus_url: Assembles a complete nexus URL from the base url and query parameters
  • archive::go_md5: Retrieves and returns specific file's md5 from GoCD server md5 checksum file

Classes

archive

Manages archive module's dependencies.

Examples

On Windows, ensure 7zip is installed using the default chocolatey provider.
include archive
On Windows, install a 7zip MSI with the native windows package provider.
class { 'archive':
  seven_zip_name     => '7-Zip 9.20 (x64 edition)',
  seven_zip_source   => 'C:/Windows/Temp/7z920-x64.msi',
  seven_zip_provider => 'windows',
}
Install the AWS CLI tool. (Not supported on Windows).
class { 'archive':
  aws_cli_install => true,
}
Deploy a specific archive
class { 'archive':
  archives => { '/tmp/jta-1.1.jar' => {
                  'ensure' => 'present',
                  'source'  => 'http://central.maven.org/maven2/javax/transaction/jta/1.1/jta-1.1.jar',
                  }, }
}

Parameters

The following parameters are available in the archive class:

seven_zip_name

Data type: Optional[String[1]]

7zip package name. This parameter only applies to Windows.

Default value: $archive::params::seven_zip_name

seven_zip_provider

Data type: Optional[Enum['chocolatey','windows','']]

7zip package provider. This parameter only applies to Windows where it defaults to chocolatey. Can be set to an empty string, (or undef via hiera), if you don't want this module to manage 7zip.

Default value: $archive::params::seven_zip_provider

seven_zip_source

Data type: Optional[String[1]]

Alternative package source for 7zip. This parameter only applies to Windows.

Default value: undef

aws_cli_install

Data type: Boolean

Installs the AWS CLI command needed for downloading from S3 buckets. This parameter is currently not implemented on Windows.

Default value: false

gsutil_install

Data type: Boolean

Installs the GSUtil CLI command needed for downloading from GS buckets. This parameter is currently not implemented on Windows.

Default value: false

archives

Data type: Hash

A hash of archive resources this module should create.

Default value: {}

archive::staging

Backwards-compatibility class for staging module

Parameters

The following parameters are available in the archive::staging class:

path

Data type: String

Absolute path of staging directory to create

Default value: $archive::params::path

owner

Data type: String

Username of directory owner

Default value: $archive::params::owner

group

Data type: String

Group of directory owner

Default value: $archive::params::group

mode

Data type: String

Mode (permissions) on staging directory

Default value: $archive::params::mode

Defined types

archive::artifactory

Archive wrapper for downloading files from artifactory

Examples

archive::artifactory { '/tmp/logo.png':
  url   => 'https://repo.jfrog.org/artifactory/distributions/images/Artifactory_120x75.png',
  owner => 'root',
  group => 'root',
  mode  => '0644',
}
$dirname = 'gradle-1.0-milestone-4-20110723151213+0300'
$filename = "${dirname}-bin.zip"

archive::artifactory { $filename:
  archive_path => '/tmp',
  url          => "http://repo.jfrog.org/artifactory/distributions/org/gradle/${filename}",
  extract      => true,
  extract_path => '/opt',
  creates      => "/opt/${dirname}",
  cleanup      => true,
}

Parameters

The following parameters are available in the archive::artifactory defined type:

url

Data type: Stdlib::HTTPUrl

artifactory download URL

headers

Data type: Array

HTTP header(s) to pass to source

Default value: []

path

Data type: String

absolute path for the download file (or use archive_path and only supply filename)

Default value: $name

ensure

Data type: Enum['present', 'absent']

ensure download file present/absent

Default value: 'present'

cleanup

Data type: Boolean

remove archive after file extraction

Default value: false

extract

Data type: Boolean

whether to extract the files

Default value: false

archive_path

Data type: Optional[Stdlib::Absolutepath]

parent directory to download archive into

Default value: undef

creates

Data type: Optional[String]

the file created when the archive is extracted

Default value: undef

extract_path

Data type: Optional[String]

absolute path to extract archive into

Default value: undef

group

Data type: Optional[String]

file group (see archive params for defaults)

Default value: undef

mode

Data type: Optional[String]

file mode (see archive params for defaults)

Default value: undef

owner

Data type: Optional[String]

file owner (see archive params for defaults)

Default value: undef

password

Data type: Optional[String]

Password to authenticate with

Default value: undef

username

Data type: Optional[String]

User to authenticate as

Default value: undef

archive::download

Archive downloader with integrity verification

Examples

archive::download {"apache-tomcat-6.0.26.tar.gz":
  ensure => present,
  url    => "http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.26/bin/apache-tomcat-6.0.26.tar.gz",
}
archive::download {"apache-tomcat-6.0.26.tar.gz":
  ensure        => present,
  digest_string => "f9eafa9bfd620324d1270ae8f09a8c89",
  url           => "http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.26/bin/apache-tomcat-6.0.26.tar.gz",
}

Parameters

The following parameters are available in the archive::download defined type:

url

Data type: String

source

headers

Data type: Array

HTTP (s) to pass to source

Default value: []

allow_insecure

Data type: Boolean

Allow self-signed certificate on source?

Default value: false

checksum

Data type: Boolean

Should checksum be validated?

Default value: true

digest_type

Data type: Enum['none', 'md5', 'sha1', 'sha2','sha256', 'sha384', 'sha512']

Digest to use for calculating checksum

Default value: 'md5'

ensure

Data type: Enum['present', 'absent']

ensure file present/absent

Default value: 'present'

src_target

Data type: Stdlib::Absolutepath

Absolute path to staging location

Default value: '/usr/src'

digest_string

Data type: Optional[String]

Value expected checksum

Default value: undef

digest_url

Data type: Optional[String]

URL expected checksum value

Default value: undef

proxy_server

Data type: Optional[String]

FQDN of proxy server

Default value: undef

user

Data type: Optional[String]

User used to download the archive

Default value: undef

archive::go

download from go

Parameters

The following parameters are available in the archive::go defined type:

server

Data type: String

port

Data type: Integer

url_path

Data type: String

md5_url_path

Data type: String

username

Data type: String

password

Data type: String

ensure

Data type: Enum['present', 'absent']

Default value: present

path

Data type: String

Default value: $name

owner

Data type: Optional[String]

Default value: undef

group

Data type: Optional[String]

Default value: undef

mode

Data type: Optional[String]

Default value: undef

extract

Data type: Optional[Boolean]

Default value: undef

extract_path

Data type: Optional[String]

Default value: undef

creates

Data type: Optional[String]

Default value: undef

cleanup

Data type: Optional[Boolean]

Default value: undef

archive_path

Data type: Optional[Stdlib::Absolutepath]

Default value: undef

archive::nexus

define: archive::nexus

archive wrapper for downloading files from Nexus using REST API. Nexus API: https://repository.sonatype.org/nexus-restlet1x-plugin/default/docs/path__artifact_maven_content.html

Parameters

Examples

archive::nexus { '/tmp/jtstand-ui-0.98.jar': url => 'https://oss.sonatype.org', gav => 'org.codehaus.jtstand:jtstand-ui:0.98', repository => 'codehaus-releases', packaging => 'jar', extract => false, }

Parameters

The following parameters are available in the archive::nexus defined type:

url

Data type: String

gav

Data type: String

repository

Data type: String

ensure

Data type: Enum['present', 'absent']

Default value: present

checksum_type

Data type: Enum['none', 'md5', 'sha1', 'sha2','sha256', 'sha384', 'sha512']

Default value: 'md5'

checksum_verify

Data type: Boolean

Default value: true

packaging

Data type: String

Default value: 'jar'

use_nexus3_urls

Data type: Boolean

Default value: false

classifier

Data type: Optional[String]

Default value: undef

extension

Data type: Optional[String]

Default value: undef

username

Data type: Optional[String]

Default value: undef

password

Data type: Optional[String]

Default value: undef

user

Data type: Optional[String]

Default value: undef

owner

Data type: Optional[String]

Default value: undef

group

Data type: Optional[String]

Default value: undef

mode

Data type: Optional[String]

Default value: undef

extract

Data type: Optional[Boolean]

Default value: undef

extract_path

Data type: Optional[String]

Default value: undef

extract_flags

Data type: Optional[String]

Default value: undef

extract_command

Data type: Optional[String]

Default value: undef

creates

Data type: Optional[String]

Default value: undef

cleanup

Data type: Optional[Boolean]

Default value: undef

proxy_server

Data type: Optional[String]

Default value: undef

proxy_type

Data type: Optional[String]

Default value: undef

allow_insecure

Data type: Optional[Boolean]

Default value: undef

temp_dir

Data type: Optional[Stdlib::Absolutepath]

Default value: undef

Resource types

archive

Manage archive file download, extraction, and cleanup.

Properties

The following properties are available in the archive type.

creates

if file/directory exists, will not download/extract archive.

ensure

Valid values: present, absent

whether archive file should be present/absent (default: present)

Default value: present

Parameters

The following parameters are available in the archive type.

allow_insecure

Valid values: true, false, yes, no

ignore HTTPS certificate errors

Default value: false

checksum

Valid values: %r{\b[0-9a-f]{5,128}\b}, true, false, undef, nil, ''

archive file checksum (match checksum_type).

checksum_type

Valid values: none, md5, sha1, sha2, sha256, sha384, sha512

archive file checksum type (none|md5|sha1|sha2|sha256|sha384|sha512).

Default value: none

checksum_url

archive file checksum source (instead of specifying checksum)

checksum_verify

Valid values: true, false

whether checksum wil be verified (true|false).

Default value: true

cleanup

Valid values: true, false

whether archive file will be removed after extraction (true|false).

Default value: true

cookie

archive file download cookie.

digest_string

Valid values: %r{\b[0-9a-f]{5,128}\b}

archive file checksum (match checksum_type) (this parameter is for camptocamp/archive compatibility).

digest_type

Valid values: none, md5, sha1, sha2, sha256, sha384, sha512

archive file checksum type (none|md5|sha1|sha2|sha256|sha384|sha512) (this parameter is camptocamp/archive compatibility).

digest_url

archive file checksum source (instead of specifying checksum) (this parameter is for camptocamp/archive compatibility)

download_options

provider download options (affects curl, wget, gs, and only s3 downloads for ruby provider)

extract

Valid values: true, false

whether archive will be extracted after download (true|false).

Default value: false

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'}.

Default value: undef

extract_path

target folder path to extract archive.

filename

archive file name (derived from path).

group

extract command group (using this option will configure the archive file permisison to 0644 so the user can read the file).

headers

optional header(s) to pass.

password

password to download source file.

path

namevar, archive file fully qualified file path.

provider

The specific backend to use for this archive resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform.

proxy_server

proxy address to use when accessing source

proxy_type

Valid values: none, ftp, http, https

proxy type (none|ftp|http|https)

source

archive file source, supports puppet|http|https|ftp|file|s3|gs uri.

target

target folder path to extract archive. (this parameter is for camptocamp/archive compatibility)

temp_dir

Specify an alternative temporary directory to use for copying files, if unset then the operating system default will be used.

url

archive file source, supports http|https|ftp|file uri. (for camptocamp/archive compatibility)

user

extract command user (using this option will configure the archive file permission to 0644 so the user can read the file).

username

username to download source file.

Functions

archive::artifactory_checksum

Type: Ruby 4.x API

A function that returns the checksum value of an artifact stored in Artifactory

archive::artifactory_checksum(Stdlib::HTTPUrl $url, Optional[Enum['sha1','sha256','md5']] $checksum_type)

The archive::artifactory_checksum function.

Returns: String Returns the checksum.

url

Data type: Stdlib::HTTPUrl

The URL of the artifact.

checksum_type

Data type: Optional[Enum['sha1','sha256','md5']]

The checksum type. Note the function will raise an error if you ask for sha256 but your artifactory instance doesn't have the sha256 value calculated.

archive::artifactory_latest_url

Type: Ruby 4.x API

The archive::artifactory_latest_url function.

archive::artifactory_latest_url(Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $url, Hash $maven_data)

The archive::artifactory_latest_url function.

Returns: Any

url

Data type: Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]

maven_data

Data type: Hash

archive::parse_artifactory_url

Type: Ruby 4.x API

A function to parse an Artifactory maven 2 repository URL

archive::parse_artifactory_url(Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $url)

A function to parse an Artifactory maven 2 repository URL

Returns: Any

url

Data type: Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]