Puppet Function: tp::url_replace
- Defined in:
- functions/url_replace.pp
- Function type:
- Puppet Language
Overview
Function tp::url_replace. Gets an url and coverts is based on a given map
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'functions/url_replace.pp', line 3
function tp::url_replace (
String $url,
String $_version,
) {
# TODO: Improve and make dynamic when needed
$translated_arch = $facts['os']['architecture'] ? {
'x86_64' => 'amd64',
'x64' => 'amd64',
'i386' => '386',
default => $facts['os']['architecture'],
}
$versioned_url = regsubst($url,'\$VERSION', $_version, 'G')
$os_replaced_url = regsubst($versioned_url,'\$OS', downcase($facts['kernel']), 'G')
$arch_replaced_url = regsubst($os_replaced_url,'\$ARCH', downcase($translated_arch), 'G') # lint-ignore: 140chars
return $arch_replaced_url
}
|