From ac9002ccaf8dd8257f1d74fc5072d44117f4c9b6 Mon Sep 17 00:00:00 2001 From: Yevgenii Yevtushenko Date: Tue, 18 Oct 2016 22:23:43 +0300 Subject: [PATCH 1/4] Add new RPM GPG key for zabbix-3.2 and higher. --- manifests/repo.pp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/manifests/repo.pp b/manifests/repo.pp index 9aff4d337..aa5211ded 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -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', } @@ -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', } From 9192ad1352c35bcdbf103328e320f30184887023 Mon Sep 17 00:00:00 2001 From: Yevgenii Yevtushenko Date: Wed, 19 Oct 2016 21:54:06 +0300 Subject: [PATCH 2/4] Add tests for RPM GPG KEY. --- spec/classes/repo_spec.rb | 109 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/spec/classes/repo_spec.rb b/spec/classes/repo_spec.rb index 462a3f7d9..5bfcc7e50 100644 --- a/spec/classes/repo_spec.rb +++ b/spec/classes/repo_spec.rb @@ -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 @@ -361,7 +363,9 @@ 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 @@ -392,7 +396,9 @@ 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 @@ -423,7 +429,75 @@ 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 @@ -454,6 +528,41 @@ 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 From 2d9ae3f4121c9e8dd338347f93f3b4e82c359999 Mon Sep 17 00:00:00 2001 From: Yevgenii Yevtushenko Date: Thu, 20 Oct 2016 21:18:51 +0300 Subject: [PATCH 3/4] Replace '$majorrelease' with 'majorrelease'. --- spec/classes/repo_spec.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/classes/repo_spec.rb b/spec/classes/repo_spec.rb index 5bfcc7e50..afeebaef5 100644 --- a/spec/classes/repo_spec.rb +++ b/spec/classes/repo_spec.rb @@ -350,7 +350,7 @@ :operatingsystemmajrelease => '6', :architecture => 'x86_64', :osfamily => 'RedHat', - :$majorrelease => '6', + :majorrelease => '6', :is_pe => false, :puppetversion => Puppet.version, :facterversion => Facter.version, @@ -383,7 +383,7 @@ :operatingsystemmajrelease => '6', :architecture => 'x86_64', :osfamily => 'RedHat', - :$majorrelease => '6', + :majorrelease => '6', :is_pe => false, :puppetversion => Puppet.version, :facterversion => Facter.version, @@ -416,7 +416,7 @@ :operatingsystemmajrelease => '6', :architecture => 'x86_64', :osfamily => 'RedHat', - :$majorrelease => '6', + :majorrelease => '6', :is_pe => false, :puppetversion => Puppet.version, :facterversion => Facter.version, @@ -449,7 +449,7 @@ :operatingsystemmajrelease => '6', :architecture => 'x86_64', :osfamily => 'RedHat', - :$majorrelease => '6', + :majorrelease => '6', :is_pe => false, :puppetversion => Puppet.version, :facterversion => Facter.version, @@ -482,7 +482,7 @@ :operatingsystemmajrelease => '6', :architecture => 'x86_64', :osfamily => 'RedHat', - :$majorrelease => '6', + :majorrelease => '6', :is_pe => false, :puppetversion => Puppet.version, :facterversion => Facter.version, @@ -515,7 +515,7 @@ :operatingsystemmajrelease => '7', :architecture => 'x86_64', :osfamily => 'RedHat', - :$majorrelease => '7', + :majorrelease => '7', :is_pe => false, :puppetversion => Puppet.version, :facterversion => Facter.version, @@ -548,7 +548,7 @@ :operatingsystemmajrelease => '7', :architecture => 'x86_64', :osfamily => 'RedHat', - :$majorrelease => '7', + :majorrelease => '7', :is_pe => false, :puppetversion => Puppet.version, :facterversion => Facter.version, From 4ef9948b5fb3e4b72591e35265ae7c15c45dc60a Mon Sep 17 00:00:00 2001 From: Yevgenii Yevtushenko Date: Thu, 20 Oct 2016 21:29:41 +0300 Subject: [PATCH 4/4] Migrate RedHat facts to hash notation. --- spec/classes/repo_spec.rb | 196 +++++++++++++++++++------------------- 1 file changed, 98 insertions(+), 98 deletions(-) diff --git a/spec/classes/repo_spec.rb b/spec/classes/repo_spec.rb index afeebaef5..684b16de9 100644 --- a/spec/classes/repo_spec.rb +++ b/spec/classes/repo_spec.rb @@ -345,20 +345,20 @@ 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 @@ -378,20 +378,20 @@ 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 @@ -411,20 +411,20 @@ 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 @@ -444,20 +444,20 @@ 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 @@ -477,20 +477,20 @@ 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 @@ -510,20 +510,20 @@ 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 @@ -543,20 +543,20 @@ 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