Puppet Class: puppet_agent::prepare::package
- Defined in:
- manifests/prepare/package.pp
Summary
Ensures correct puppet-agent package is downloaded locally.Overview
for installation. This is used on platforms without package managers capable of working with a remote https repository.
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 |
# File 'manifests/prepare/package.pp', line 6
class puppet_agent::prepare::package (
Optional $source,
) {
assert_private()
file { $puppet_agent::params::local_packages_dir:
ensure => directory,
}
# In order for the 'basename' function to work correctly we need to change
# any \s to /s (even for windows UNC paths) so that it will correctly pull off
# the filename. Since this operation is only grabbing the base filename and not
# any part of the path this should be safe, since the source will simply remain
# what it was before and we can still pull off the filename.
$package_file_name = basename(regsubst($source, "\\\\", '/', 'G'))
if $facts['os']['family'] =~ /windows/ {
$local_package_file_path = windows_native_path("${puppet_agent::params::local_packages_dir}/${package_file_name}")
$mode = undef
} else {
$local_package_file_path = "${puppet_agent::params::local_packages_dir}/${package_file_name}"
$mode = '0644'
}
file { $local_package_file_path:
ensure => file,
owner => $puppet_agent::params::user,
group => $puppet_agent::params::group,
mode => $mode,
source => $source,
require => File[$puppet_agent::params::local_packages_dir],
checksum => sha256lite,
}
}
|