From 5b9bb12f3a8e04836287e6d0142c4828277770bd Mon Sep 17 00:00:00 2001 From: Shubham Shinde Date: Fri, 5 Jan 2024 20:04:54 +0530 Subject: [PATCH] (PE-37297) Optimized Amazon linux 2023 support code & tests --- .gitignore | 2 ++ acceptance/Gemfile | 2 +- manifests/osfamily/redhat.pp | 16 +++++++++++----- .../classes/puppet_agent_osfamily_redhat_spec.rb | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 988dcbbe..7c9210fe 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,5 @@ .envrc /inventory.yaml /spec/fixtures/litmus_inventory.yaml +/acceptance/junit +/acceptance/log \ No newline at end of file diff --git a/acceptance/Gemfile b/acceptance/Gemfile index 1b28744f..e7976986 100644 --- a/acceptance/Gemfile +++ b/acceptance/Gemfile @@ -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') diff --git a/manifests/osfamily/redhat.pp b/manifests/osfamily/redhat.pp index 36e6693d..fe46fa36 100644 --- a/manifests/osfamily/redhat.pp +++ b/manifests/osfamily/redhat.pp @@ -18,12 +18,18 @@ $platform_and_version = "fedora/${facts['os']['release']['major']}" } 'Amazon': { - if ("${facts['os']['release']['major']}" == '2') { - $amz_el_version = '7' - } else { - $amz_el_version = '6' + $major_version = $facts['os']['release']['major'] + $amz_el_version = "${major_version}" ? { + '2' => '7', + '2017' => '6', + '2018' => '6', + default => $major_version, + } + + $platform_and_version = "${amz_el_version}" ? { + /^(6|7)$/ => "el/${amz_el_version}", + default => "amazon/${amz_el_version}", } - $platform_and_version = "el/${amz_el_version}" } default: { $platform_and_version = "el/${facts['os']['release']['major']}" diff --git a/spec/classes/puppet_agent_osfamily_redhat_spec.rb b/spec/classes/puppet_agent_osfamily_redhat_spec.rb index bea3e209..e6d5b4e7 100644 --- a/spec/classes/puppet_agent_osfamily_redhat_spec.rb +++ b/spec/classes/puppet_agent_osfamily_redhat_spec.rb @@ -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, }, })