Skip to content

Commit caa51e9

Browse files
committed
Restore support for AL2 x86_64 install_shell task
Commit bf467db fixed AL2 aarch64, but broke AL2 x86_64 causing the task to install the `puppetN-release-amazon-2.noarch.rpm` release package, but later attempts to `yum install puppet-agent` would fail, since there are no AL2 x86_64 builds. It also broke future releases of amazon, so the hypothetical AL 2025 would fallback to el-2025. This commit results on the following mapping: AL2 x86_64 -> puppetN-release-el-7.noarch.rpm AL2 aarch64 -> puppetN-release-amazon-2.noarch.rpm AL2023 (all) -> puppetN-release-amazon-2023.noarch.rpm And ensures future AL releases work as expected.
1 parent 6d5dbbf commit caa51e9

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

manifests/osfamily/redhat.pp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@
4040
if ($puppet_agent::is_pe and (!$puppet_agent::use_alternate_sources)) {
4141
$pe_server_version = pe_build_version()
4242
# Install amazon packages on AL2 (only aarch64) and 2003 and up (all arch)
43-
if $facts['os']['name'] == 'Amazon' and "$amz_el_version" =~ /^(6|7)$/ {
44-
$pe_repo_dir = "el-${amz_el_version}-${facts['os']['architecture']}"
43+
if $facts['os']['name'] == 'Amazon' {
44+
# lint:ignore:only_variable_string
45+
$pe_repo_dir = "${amz_el_version}" ? {
46+
/^(6|7)$/ => "el-${amz_el_version}-${facts['os']['architecture']}",
47+
default => $facts['platform_tag'],
48+
}
49+
# lint:endignore
4550
} else {
4651
$pe_repo_dir = $facts['platform_tag']
4752
}

tasks/install_shell.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,6 @@ case $platform in
284284
"SLES")
285285
platform_version=$major_version
286286
;;
287-
"Amzn"|"Amazon Linux")
288-
case $platform_version in
289-
"2") platform_version="2";;
290-
esac
291-
;;
292287
esac
293288

294289
# Find which version of puppet is currently installed if any
@@ -662,8 +657,11 @@ case $platform in
662657
info "Amazon platform! Lets get you an RPM..."
663658
filetype="rpm"
664659
platform_package="el"
665-
# For Amazon Linux 2023 and onwards we can use the 'amazon' packages created instead of 'el' packages
666-
if (( $platform_version == 2023 || $platform_version == 2 )); then
660+
arch="$(uname -p)"
661+
# Install amazon packages on AL2 (only aarch64) and 2003 and up (all arch)
662+
if (( $platform_version == 2 && $arch == 'x86_64' )); then
663+
platform_version="7"
664+
elsif (( $platform_version == 2 || $platform_version >= 2023 )); then
667665
platform_package="amazon"
668666
fi
669667
filename="${collection}-release-${platform_package}-${platform_version}.noarch.rpm"

0 commit comments

Comments
 (0)