From 22530fae51ef6641cd4d3d73022f554002014c05 Mon Sep 17 00:00:00 2001 From: Joshua Snapp Date: Fri, 20 Jan 2023 17:30:52 -0500 Subject: [PATCH] Provide correct gpgkey for RHEL family, version >= 9. Zabbix changed their gpgkey for RHEL operating systems newer than version 8. The new key works for both the "zabbix" and "zabbix_nonsupported" repos. --- manifests/repo.pp | 9 +++++++-- spec/classes/repo_spec.rb | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/manifests/repo.pp b/manifests/repo.pp index 5be91f8db..7890343c6 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -34,8 +34,13 @@ } case $facts['os']['family'] { 'RedHat': { - $gpgkey_zabbix = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591' - $gpgkey_nonsupported = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-79EA5ED4' + if versioncmp(fact('os.release.major'), '9') >= 0 { + $gpgkey_zabbix = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD' + $gpgkey_nonsupported = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD' + } else { + $gpgkey_zabbix = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591' + $gpgkey_nonsupported = 'https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-79EA5ED4' + } $_repo_location = $repo_location ? { undef => "https://repo.zabbix.com/zabbix/${zabbix_version}/rhel/${majorrelease}/\$basearch/", diff --git a/spec/classes/repo_spec.rb b/spec/classes/repo_spec.rb index b9704b740..f3ad90c65 100644 --- a/spec/classes/repo_spec.rb +++ b/spec/classes/repo_spec.rb @@ -112,6 +112,35 @@ it { is_expected.to contain_package('zabbix-required-scl-repo').with_ensure('latest').with_name('centos-release-scl') } end + when '9' + + context 'on RedHat 9 and Zabbix 5.0' do + let :params do + { + zabbix_version: '5.0', + manage_repo: true + } + end + + it { is_expected.to contain_yumrepo('zabbix').with_baseurl('https://repo.zabbix.com/zabbix/5.0/rhel/9/$basearch/') } + it { is_expected.to contain_yumrepo('zabbix').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD') } + it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_baseurl('https://repo.zabbix.com/non-supported/rhel/9/$basearch/') } + it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD') } + end + + context 'on RedHat 9 and Zabbix 6.0' do + let :params do + { + zabbix_version: '6.0', + manage_repo: true + } + end + + it { is_expected.to contain_yumrepo('zabbix').with_baseurl('https://repo.zabbix.com/zabbix/6.0/rhel/9/$basearch/') } + it { is_expected.to contain_yumrepo('zabbix').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD') } + it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_baseurl('https://repo.zabbix.com/non-supported/rhel/9/$basearch/') } + it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD') } + end end end end