Skip to content

Commit

Permalink
Restore support for AL2 x86_64 install_shell task
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
joshcooper committed Jun 22, 2024
1 parent 6d5dbbf commit caa51e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
9 changes: 7 additions & 2 deletions manifests/osfamily/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@
if ($puppet_agent::is_pe and (!$puppet_agent::use_alternate_sources)) {
$pe_server_version = pe_build_version()
# Install amazon packages on AL2 (only aarch64) and 2003 and up (all arch)
if $facts['os']['name'] == 'Amazon' and "$amz_el_version" =~ /^(6|7)$/ {
$pe_repo_dir = "el-${amz_el_version}-${facts['os']['architecture']}"
if $facts['os']['name'] == 'Amazon' {
# lint:ignore:only_variable_string
$pe_repo_dir = "${amz_el_version}" ? {
/^(6|7)$/ => "el-${amz_el_version}-${facts['os']['architecture']}",
default => $facts['platform_tag'],
}
# lint:endignore
} else {
$pe_repo_dir = $facts['platform_tag']
}
Expand Down
12 changes: 5 additions & 7 deletions tasks/install_shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,6 @@ case $platform in
"SLES")
platform_version=$major_version
;;
"Amzn"|"Amazon Linux")
case $platform_version in
"2") platform_version="2";;
esac
;;
esac

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

0 comments on commit caa51e9

Please sign in to comment.