Defined Type: archive::go
- Defined in:
- manifests/go.pp
Overview
download from go
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'manifests/go.pp', line 2
define archive::go (
String $server,
Integer $port,
String $url_path,
String $md5_url_path,
String $username,
String $password,
Enum['present', 'absent'] $ensure = present,
String $path = $name,
Optional[String] $owner = undef,
Optional[String] $group = undef,
Optional[String] $mode = undef,
Optional[Boolean] $extract = undef,
Optional[String] $extract_path = undef,
Optional[String] $creates = undef,
Optional[Boolean] $cleanup = undef,
Optional[Stdlib::Absolutepath] $archive_path = undef,
) {
include archive::params
if $archive_path {
$file_path = "${archive_path}/${name}"
} else {
$file_path = $path
}
if $file_path !~ Stdlib::Absolutepath {
fail("archive::go[${name}]: \$name or \$archive_path must be an absolute path!") # lint:ignore:trailing_comma
}
$go_url = "http://${server}:${port}"
$file_url = "${go_url}/${url_path}"
$md5_url = "${go_url}/${md5_url_path}"
archive { $file_path:
ensure => $ensure,
path => $file_path,
extract => $extract,
extract_path => $extract_path,
source => $file_url,
checksum => archive::go_md5($username, $password, $name, $md5_url),
checksum_type => 'md5',
creates => $creates,
cleanup => $cleanup,
username => $username,
password => $password,
}
$file_owner = pick($owner, $archive::params::owner)
$file_group = pick($group, $archive::params::group)
$file_mode = pick($mode, $archive::params::mode)
file { $file_path:
owner => $file_owner,
group => $file_group,
mode => $file_mode,
require => Archive[$file_path],
}
}
|