From 9d083dad7f68e5c0e8988ceafd84cf90fc1072d8 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Wed, 4 Oct 2023 14:13:39 +0200 Subject: [PATCH] install Zabbix 6.0 by default everywhere but EL7 --- manifests/params.pp | 4 +++- spec/classes/agent_spec.rb | 8 ++++++-- spec/classes/proxy_spec.rb | 6 +++--- spec/classes/sender_spec.rb | 8 +++++++- spec/classes/server_spec.rb | 6 +++++- 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 4bd48efe8..14c88fbcf 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -127,8 +127,10 @@ if downcase($facts['kernel']) == 'windows' { $zabbix_version = '4.4.5' - } else { + } elsif $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7' { $zabbix_version = '5.0' + } else { + $zabbix_version = '6.0' } $manage_startup_script = downcase($facts['kernel']) ? { diff --git a/spec/classes/agent_spec.rb b/spec/classes/agent_spec.rb index 0f9b77c29..0aaf7ab9f 100644 --- a/spec/classes/agent_spec.rb +++ b/spec/classes/agent_spec.rb @@ -37,10 +37,14 @@ else '/etc/zabbix/zabbix_agentd.d' end - zabbix_version = '5.0' - let(:facts) { facts } + zabbix_version = if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7' + '5.0' + else + '6.0' + end + case facts[:osfamily] when 'Gentoo' package_name = 'zabbix' diff --git a/spec/classes/proxy_spec.rb b/spec/classes/proxy_spec.rb index edbdcb982..585a78c8d 100644 --- a/spec/classes/proxy_spec.rb +++ b/spec/classes/proxy_spec.rb @@ -47,7 +47,7 @@ } end - it { is_expected.to contain_class('zabbix::repo').with_zabbix_version('5.0') } + it { is_expected.to contain_class('zabbix::repo').with_zabbix_version('6.0') } it { is_expected.to contain_package('zabbix-proxy-pgsql').with_require('Class[Zabbix::Repo]') } it { is_expected.to contain_yumrepo('zabbix-nonsupported') } it { is_expected.to contain_yumrepo('zabbix') } @@ -106,7 +106,7 @@ end it { is_expected.to contain_class('zabbix::database::postgresql').with_zabbix_type('proxy') } - it { is_expected.to contain_class('zabbix::database::postgresql').with_zabbix_version('5.0') } + it { is_expected.to contain_class('zabbix::database::postgresql').with_zabbix_version('6.0') } it { is_expected.to contain_class('zabbix::database::postgresql').with_database_name('zabbix_proxy') } it { is_expected.to contain_class('zabbix::database::postgresql').with_database_user('zabbix-proxy') } it { is_expected.to contain_class('zabbix::database::postgresql').with_database_password('zabbix-proxy') } @@ -126,7 +126,7 @@ end it { is_expected.to contain_class('zabbix::database::mysql').with_zabbix_type('proxy') } - it { is_expected.to contain_class('zabbix::database::mysql').with_zabbix_version('5.0') } + it { is_expected.to contain_class('zabbix::database::mysql').with_zabbix_version('6.0') } it { is_expected.to contain_class('zabbix::database::mysql').with_database_name('zabbix_proxy') } it { is_expected.to contain_class('zabbix::database::mysql').with_database_user('zabbix-proxy') } it { is_expected.to contain_class('zabbix::database::mysql').with_database_password('zabbix-proxy') } diff --git a/spec/classes/sender_spec.rb b/spec/classes/sender_spec.rb index e7ac5493b..de0f5931f 100644 --- a/spec/classes/sender_spec.rb +++ b/spec/classes/sender_spec.rb @@ -15,6 +15,12 @@ facts end + zabbix_version = if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7' + '5.0' + else + '6.0' + end + context 'with all defaults' do it { is_expected.to contain_class('zabbix::sender') } it { is_expected.to contain_class('zabbix::params') } @@ -34,7 +40,7 @@ if %w[Archlinux Gentoo].include?(facts[:osfamily]) it { is_expected.not_to compile.with_all_deps } else - it { is_expected.to contain_class('zabbix::repo').with_zabbix_version('5.0') } + it { is_expected.to contain_class('zabbix::repo').with_zabbix_version(zabbix_version) } it { is_expected.to contain_package('zabbix-sender').with_require('Class[Zabbix::Repo]') } end diff --git a/spec/classes/server_spec.rb b/spec/classes/server_spec.rb index 0933507f9..2bb5d5408 100644 --- a/spec/classes/server_spec.rb +++ b/spec/classes/server_spec.rb @@ -15,7 +15,11 @@ context "on #{os}" do let(:facts) { facts } - zabbix_version = '5.0' + zabbix_version = if facts[:os]['family'] == 'RedHat' && facts[:os]['release']['major'] == '7' + '5.0' + else + '6.0' + end describe 'with default settings' do it { is_expected.to contain_class('zabbix::repo') }