Skip to content

Commit

Permalink
[PE-37297]: Optimized Amazon linux 2023 support code & tests
Browse files Browse the repository at this point in the history
  • Loading branch information
span786 committed Dec 29, 2023
1 parent b94cfb4 commit ff5c8ae
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion acceptance/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ gem "beaker-puppet", *location_for(ENV['BEAKER_PUPPET_VERSION'] || 'https://gith
gem "beaker-docker", *location_for(ENV['BEAKER_DOCKER_VERSION'] || '~> 0')
gem "beaker-vagrant", *location_for(ENV['BEAKER_VAGRANT_VERSION'] || '~> 0')
gem "beaker-vmpooler", *location_for(ENV['BEAKER_VMPOOLER_VERSION'] || '~> 1')
gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'] || '~> 1')
gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'] || '~> 2')
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0')
17 changes: 7 additions & 10 deletions manifests/osfamily/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@
}
'Amazon': {
$major_version = $facts['os']['release']['major']
if ("${major_version}" == '2') {
$amz_el_version = '7'
}
else {
$amz_el_version = '6'
$amz_el_version = "${major_version}" ? {
'2' => '7',
'2017' => '6',
default => $major_version,
}

if ("${amz_el_version}" =~ /^(\A6\z|\A7\z)/) {
$platform_and_version = "el/${amz_el_version}"
}
else {
$platform_and_version = "amazon/${major_version}"
$platform_and_version = "${amz_el_version}" ? {
/^(6|7)$/ => "el/${amz_el_version}",
default => "amazon/${amz_el_version}",
}
}
default: {
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/puppet_agent_osfamily_redhat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
end

[['Rocky', 'el/8', 8], ['AlmaLinux', 'el/8', 8], ['Fedora', 'fedora/f36', 36], ['CentOS', 'el/7', 7], ['Amazon', 'el/6', 2017], ['Amazon', 'el/7', 2]].each do |os, urlbit, osmajor|
[['Rocky', 'el/8', 8], ['AlmaLinux', 'el/8', 8], ['Fedora', 'fedora/f36', 36], ['CentOS', 'el/7', 7], ['Amazon', 'el/6', 2017], ['Amazon', 'el/7', 2], ['Amazon', 'amazon/2023', 2023]].each do |os, urlbit, osmajor|
context "with #{os} and #{urlbit}" do
let(:facts) do
override_facts(super(), os: { name: os, release: { major: osmajor, }, })
Expand Down

0 comments on commit ff5c8ae

Please sign in to comment.