Skip to content

Commit 610b6da

Browse files
committed
(PA-6677) Restore support for AL2 x86_64 in manifests
Commit 5c3ffe8 fixed AL2 aarch64, but broke AL2 x86_64. This commit restores the previous behavior of installing AL2 packages on AL2 aarch64. It preserves the existing behavior of installing EL6/7 packages on AL1/2 x86_64, respectively.
1 parent 08b9f34 commit 610b6da

File tree

2 files changed

+30
-19
lines changed

2 files changed

+30
-19
lines changed

manifests/osfamily/redhat.pp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@
1919
}
2020
'Amazon': {
2121
$major_version = $facts['os']['release']['major']
22-
$amz_el_version = "${major_version}" ? {
23-
/^(2017|2018)$/ => '6',
22+
$arch = $facts['os']['architecture']
23+
$amz_el_version = "${major_version}-${arch}" ? {
24+
'2-aarch64' => '2',
25+
'2-x86_64' => '7',
26+
/^(2017|2018)-/ => '6',
2427
default => $major_version,
2528
}
2629

@@ -36,10 +39,16 @@
3639
# lint:endignore
3740
if ($puppet_agent::is_pe and (!$puppet_agent::use_alternate_sources)) {
3841
$pe_server_version = pe_build_version()
39-
# Treat Amazon Linux just like Enterprise Linux
40-
$pe_repo_dir = ($facts['os']['name'] == 'Amazon') ? {
41-
true => "el-${amz_el_version}-${facts['os']['architecture']}",
42-
default => $facts['platform_tag'],
42+
# Install amazon packages on AL2 (only aarch64) and 2003 and up (all arch)
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
50+
} else {
51+
$pe_repo_dir = $facts['platform_tag']
4352
}
4453
if $puppet_agent::source {
4554
$source = "${puppet_agent::source}/packages/${pe_server_version}/${pe_repo_dir}"

spec/classes/puppet_agent_osfamily_redhat_spec.rb

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,21 @@
2222
end
2323

2424
[
25-
['Rocky', 'el/8', '8'],
26-
['AlmaLinux', 'el/8', '8'],
27-
['AlmaLinux', 'el/9', '9'],
28-
['Fedora', 'fedora/f36', '36'],
29-
['CentOS', 'el/7', '7'],
30-
['Amazon', 'el/6', '2017'],
31-
['Amazon', 'el/6', '2018'],
32-
['Amazon', 'amazon/2', '2'],
33-
['Amazon', 'amazon/2023', '2023'],
34-
].each do |os, urlbit, osmajor|
25+
['Rocky', 'el/8', '8', 'x86_64'],
26+
['AlmaLinux', 'el/8', '8', 'x86_64'],
27+
['AlmaLinux', 'el/9', '9', 'x86_64'],
28+
['Fedora', 'fedora/f36', '36', 'x86_64'],
29+
['CentOS', 'el/7', '7', 'x86_64'],
30+
['Amazon', 'el/6', '2017', 'x86_64'],
31+
['Amazon', 'el/6', '2018', 'x86_64'],
32+
['Amazon', 'el/7', '2', 'x86_64'],
33+
['Amazon', 'amazon/2', '2', 'aarch64'],
34+
['Amazon', 'amazon/2023', '2023', 'x86_64'],
35+
['Amazon', 'amazon/2023', '2023', 'aarch64'],
36+
].each do |os, urlbit, osmajor, arch|
3537
context "with #{os} and #{urlbit}" do
3638
let(:facts) do
37-
override_facts(super(), os: { name: os, release: { major: osmajor } })
39+
override_facts(super(), os: { name: os, release: { major: osmajor }, architecture: arch })
3840
end
3941

4042
script = <<-SCRIPT
@@ -148,7 +150,7 @@
148150
is_expected.to contain_yumrepo('pc_repo')
149151
.with({
150152
# We no longer expect the 'f' in fedora repos
151-
'baseurl' => "http://yum.puppet.com/puppet5/#{urlbit.gsub('/f', '/')}/x64",
153+
'baseurl' => "http://yum.puppet.com/puppet5/#{urlbit.gsub('/f', '/')}/#{arch}",
152154
'enabled' => 'true',
153155
'gpgcheck' => '1',
154156
'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppet\n file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppet-20250406",
@@ -165,7 +167,7 @@
165167
}
166168
end
167169

168-
it { is_expected.to contain_yumrepo('pc_repo').with_baseurl("http://fake-yum.com/puppet5/#{urlbit.gsub('/f', '/')}/x64") }
170+
it { is_expected.to contain_yumrepo('pc_repo').with_baseurl("http://fake-yum.com/puppet5/#{urlbit.gsub('/f', '/')}/#{arch}") }
169171
end
170172
end
171173
end

0 commit comments

Comments
 (0)