From 1dd4eb08caecfea4a1dba7ff3bbebd5a8f8fa16f Mon Sep 17 00:00:00 2001 From: mihaibuzgau Date: Wed, 18 Mar 2020 17:40:11 +0200 Subject: [PATCH] (MODULES-10110) Handle Amazon Linux 2 as el-7 --- manifests/osfamily/redhat.pp | 11 ++++++++--- spec/classes/puppet_agent_osfamily_redhat_spec.rb | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/manifests/osfamily/redhat.pp b/manifests/osfamily/redhat.pp index e9452bb54..0b15f11b8 100644 --- a/manifests/osfamily/redhat.pp +++ b/manifests/osfamily/redhat.pp @@ -16,7 +16,12 @@ $platform_and_version = "fedora/${::operatingsystemmajrelease}" } 'Amazon': { - $platform_and_version = 'el/6' + if ("${::operatingsystemmajrelease}" == '2') { + $amz_el_version = '7' + } else { + $amz_el_version = '6' + } + $platform_and_version = "el/${amz_el_version}" } default: { $platform_and_version = "el/${::operatingsystemmajrelease}" @@ -24,9 +29,9 @@ } if ($::puppet_agent::is_pe and (!$::puppet_agent::use_alternate_sources)) { $pe_server_version = pe_build_version() - # Treat Amazon Linux just like Enterprise Linux 6 + # Treat Amazon Linux just like Enterprise Linux $pe_repo_dir = ($::operatingsystem == 'Amazon') ? { - true => "el-6-${::architecture}", + true => "el-${amz_el_version}-${::architecture}", default => $::platform_tag, } if $::puppet_agent::source { diff --git a/spec/classes/puppet_agent_osfamily_redhat_spec.rb b/spec/classes/puppet_agent_osfamily_redhat_spec.rb index 6209db61e..b3b8abe79 100644 --- a/spec/classes/puppet_agent_osfamily_redhat_spec.rb +++ b/spec/classes/puppet_agent_osfamily_redhat_spec.rb @@ -18,7 +18,7 @@ } end - [['Fedora', 'fedora/f31', 31], ['CentOS', 'el/7', 7], ['Amazon', 'el/6', 6]].each do |os, urlbit, osmajor| + [['Fedora', 'fedora/f31', 31], ['CentOS', 'el/7', 7], ['Amazon', 'el/6', 2017], ['Amazon', 'el/7', 2]].each do |os, urlbit, osmajor| context "with #{os} and #{urlbit}" do let(:facts) do super().merge(:operatingsystem => os, :operatingsystemmajrelease => osmajor)