X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;ds=sidebyside;f=3rdparty%2Fmodules%2Farchive%2Fmanifests%2Fgo.pp;fp=3rdparty%2Fmodules%2Farchive%2Fmanifests%2Fgo.pp;h=96c021c82341153301e515796343ffb6b9fa30a0;hb=ce70d6baf887ae03a2a6a7f5e73eb2e2c3dea208;hp=0000000000000000000000000000000000000000;hpb=0ba93256399fbad7ed8fabfa39c24dd47169dde3;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/archive/manifests/go.pp b/3rdparty/modules/archive/manifests/go.pp new file mode 100644 index 000000000..96c021c82 --- /dev/null +++ b/3rdparty/modules/archive/manifests/go.pp @@ -0,0 +1,61 @@ +# download from go +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::Compat::Absolute_path] $archive_path = undef, +) { + + include ::archive::params + + if $archive_path { + $file_path = "${archive_path}/${name}" + } else { + $file_path = $path + } + + if $file_path !~ Stdlib::Compat::Absolute_path { + 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 => 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], + } +}