Skip to content

Commit

Permalink
Merge pull request #300 from yevtushenko/fix_rpm_gpg_key
Browse files Browse the repository at this point in the history
Add new RPM GPG key for zabbix-3.2 and higher
  • Loading branch information
bastelfreak authored Oct 20, 2016
2 parents 36e6b17 + 4ef9948 commit e04e9b4
Show file tree
Hide file tree
Showing 2 changed files with 175 additions and 58 deletions.
12 changes: 10 additions & 2 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,20 @@

case $::osfamily {
'RedHat' : {
# Zabbix-3.2 and newer RPMs are signed with the GPG key
if versioncmp($zabbix_version, '3.2') < 0 {
$gpgkey = 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX'
}
else {
$gpgkey = 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591'
}

yumrepo { 'zabbix':
name => "Zabbix_${reponame}_${::architecture}",
descr => "Zabbix_${reponame}_${::architecture}",
baseurl => "http://repo.zabbix.com/zabbix/${zabbix_version}/rhel/${majorrelease}/\$basearch/",
gpgcheck => '1',
gpgkey => 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX',
gpgkey => $gpgkey,
priority => '1',
}

Expand All @@ -66,7 +74,7 @@
descr => "Zabbix_nonsupported_${reponame}_${::architecture}",
baseurl => "http://repo.zabbix.com/non-supported/rhel/${majorrelease}/\$basearch/",
gpgcheck => '1',
gpgkey => 'http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX',
gpgkey => $gpgkey,
priority => '1',
}

Expand Down
221 changes: 165 additions & 56 deletions spec/classes/repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,9 @@
end

it { should contain_yumrepo('zabbix').with_baseurl('http://repo.zabbix.com/zabbix/2.0/rhel/5/$basearch/') }
it { should contain_yumrepo('zabbix').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX') }
it { should contain_yumrepo('zabbix-nonsupported').with_baseurl('http://repo.zabbix.com/non-supported/rhel/5/$basearch/') }
it { should contain_yumrepo('zabbix-nonsupported').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX') }
end

context 'on RedHat 6 and Zabbix 2.0' do
Expand All @@ -343,25 +345,27 @@

let :facts do
{
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6',
:operatingsystemmajrelease => '6',
:architecture => 'x86_64',
:osfamily => 'RedHat',
:$majorrelease => '6',
:is_pe => false,
:puppetversion => Puppet.version,
:facterversion => Facter.version,
:ipaddress => '192.168.1.10',
:lsbdistcodename => '',
:id => 'root',
:kernel => 'Linux',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin'
operatingsystem: 'RedHat',
operatingsystemrelease: '6',
operatingsystemmajrelease: '6',
architecture: 'x86_64',
osfamily: 'RedHat',
majorrelease: '6',
is_pe: false,
puppetversion: Puppet.version,
facterversion: Facter.version,
ipaddress: '192.168.1.10',
lsbdistcodename: '',
id: 'root',
kernel: 'Linux',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin'
}
end

it { should contain_yumrepo('zabbix').with_baseurl('http://repo.zabbix.com/zabbix/2.0/rhel/6/$basearch/') }
it { should contain_yumrepo('zabbix').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX') }
it { should contain_yumrepo('zabbix-nonsupported').with_baseurl('http://repo.zabbix.com/non-supported/rhel/6/$basearch/') }
it { should contain_yumrepo('zabbix-nonsupported').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX') }
end

context 'on RedHat 6 and Zabbix 2.2' do
Expand All @@ -374,25 +378,27 @@

let :facts do
{
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6',
:operatingsystemmajrelease => '6',
:architecture => 'x86_64',
:osfamily => 'RedHat',
:$majorrelease => '6',
:is_pe => false,
:puppetversion => Puppet.version,
:facterversion => Facter.version,
:ipaddress => '192.168.1.10',
:lsbdistcodename => '',
:id => 'root',
:kernel => 'Linux',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin'
operatingsystem: 'RedHat',
operatingsystemrelease: '6',
operatingsystemmajrelease: '6',
architecture: 'x86_64',
osfamily: 'RedHat',
majorrelease: '6',
is_pe: false,
puppetversion: Puppet.version,
facterversion: Facter.version,
ipaddress: '192.168.1.10',
lsbdistcodename: '',
id: 'root',
kernel: 'Linux',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin'
}
end

it { should contain_yumrepo('zabbix').with_baseurl('http://repo.zabbix.com/zabbix/2.2/rhel/6/$basearch/') }
it { should contain_yumrepo('zabbix').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX') }
it { should contain_yumrepo('zabbix-nonsupported').with_baseurl('http://repo.zabbix.com/non-supported/rhel/6/$basearch/') }
it { should contain_yumrepo('zabbix-nonsupported').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX') }
end

context 'on RedHat 6 and Zabbix 2.4' do
Expand All @@ -405,25 +411,93 @@

let :facts do
{
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6',
:operatingsystemmajrelease => '6',
:architecture => 'x86_64',
:osfamily => 'RedHat',
:$majorrelease => '6',
:is_pe => false,
:puppetversion => Puppet.version,
:facterversion => Facter.version,
:ipaddress => '192.168.1.10',
:lsbdistcodename => '',
:id => 'root',
:kernel => 'Linux',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin'
operatingsystem: 'RedHat',
operatingsystemrelease: '6',
operatingsystemmajrelease: '6',
architecture: 'x86_64',
osfamily: 'RedHat',
majorrelease: '6',
is_pe: false,
puppetversion: Puppet.version,
facterversion: Facter.version,
ipaddress: '192.168.1.10',
lsbdistcodename: '',
id: 'root',
kernel: 'Linux',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin'
}
end

it { should contain_yumrepo('zabbix').with_baseurl('http://repo.zabbix.com/zabbix/2.4/rhel/6/$basearch/') }
it { should contain_yumrepo('zabbix').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX') }
it { should contain_yumrepo('zabbix-nonsupported').with_baseurl('http://repo.zabbix.com/non-supported/rhel/6/$basearch/') }
it { should contain_yumrepo('zabbix-nonsupported').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX') }
end

context 'on RedHat 6 and Zabbix 3.0' do
let :params do
{
zabbix_version: '3.0',
manage_repo: true
}
end

let :facts do
{
operatingsystem: 'RedHat',
operatingsystemrelease: '6',
operatingsystemmajrelease: '6',
architecture: 'x86_64',
osfamily: 'RedHat',
majorrelease: '6',
is_pe: false,
puppetversion: Puppet.version,
facterversion: Facter.version,
ipaddress: '192.168.1.10',
lsbdistcodename: '',
id: 'root',
kernel: 'Linux',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin'
}
end

it { should contain_yumrepo('zabbix').with_baseurl('http://repo.zabbix.com/zabbix/3.0/rhel/6/$basearch/') }
it { should contain_yumrepo('zabbix').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX') }
it { should contain_yumrepo('zabbix-nonsupported').with_baseurl('http://repo.zabbix.com/non-supported/rhel/6/$basearch/') }
it { should contain_yumrepo('zabbix-nonsupported').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX') }
end

context 'on RedHat 6 and Zabbix 3.2' do
let :params do
{
zabbix_version: '3.2',
manage_repo: true
}
end

let :facts do
{
operatingsystem: 'RedHat',
operatingsystemrelease: '6',
operatingsystemmajrelease: '6',
architecture: 'x86_64',
osfamily: 'RedHat',
majorrelease: '6',
is_pe: false,
puppetversion: Puppet.version,
facterversion: Facter.version,
ipaddress: '192.168.1.10',
lsbdistcodename: '',
id: 'root',
kernel: 'Linux',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin'
}
end

it { should contain_yumrepo('zabbix').with_baseurl('http://repo.zabbix.com/zabbix/3.2/rhel/6/$basearch/') }
it { should contain_yumrepo('zabbix').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591') }
it { should contain_yumrepo('zabbix-nonsupported').with_baseurl('http://repo.zabbix.com/non-supported/rhel/6/$basearch/') }
it { should contain_yumrepo('zabbix-nonsupported').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591') }
end

context 'on RedHat 7 and Zabbix 3.0' do
Expand All @@ -436,24 +510,59 @@

let :facts do
{
:operatingsystem => 'RedHat',
:operatingsystemrelease => '7.1',
:operatingsystemmajrelease => '7',
:architecture => 'x86_64',
:osfamily => 'RedHat',
:$majorrelease => '7',
:is_pe => false,
:puppetversion => Puppet.version,
:facterversion => Facter.version,
:ipaddress => '192.168.1.10',
:lsbdistcodename => '',
:id => 'root',
:kernel => 'Linux',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin'
operatingsystem: 'RedHat',
operatingsystemrelease: '7.1',
operatingsystemmajrelease: '7',
architecture: 'x86_64',
osfamily: 'RedHat',
majorrelease: '7',
is_pe: false,
puppetversion: Puppet.version,
facterversion: Facter.version,
ipaddress: '192.168.1.10',
lsbdistcodename: '',
id: 'root',
kernel: 'Linux',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin'
}
end

it { should contain_yumrepo('zabbix').with_baseurl('http://repo.zabbix.com/zabbix/3.0/rhel/7/$basearch/') }
it { should contain_yumrepo('zabbix').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX') }
it { should contain_yumrepo('zabbix-nonsupported').with_baseurl('http://repo.zabbix.com/non-supported/rhel/7/$basearch/') }
it { should contain_yumrepo('zabbix-nonsupported').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX') }
end

context 'on RedHat 7 and Zabbix 3.2' do
let :params do
{
zabbix_version: '3.2',
manage_repo: true
}
end

let :facts do
{
operatingsystem: 'RedHat',
operatingsystemrelease: '7.1',
operatingsystemmajrelease: '7',
architecture: 'x86_64',
osfamily: 'RedHat',
majorrelease: '7',
is_pe: false,
puppetversion: Puppet.version,
facterversion: Facter.version,
ipaddress: '192.168.1.10',
lsbdistcodename: '',
id: 'root',
kernel: 'Linux',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin'
}
end

it { should contain_yumrepo('zabbix').with_baseurl('http://repo.zabbix.com/zabbix/3.2/rhel/7/$basearch/') }
it { should contain_yumrepo('zabbix').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591') }
it { should contain_yumrepo('zabbix-nonsupported').with_baseurl('http://repo.zabbix.com/non-supported/rhel/7/$basearch/') }
it { should contain_yumrepo('zabbix-nonsupported').with_gpgkey('http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-A14FE591') }
end
end

0 comments on commit e04e9b4

Please sign in to comment.