Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add EL9 support #893

Merged
merged 4 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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']) ? {
Expand Down
9 changes: 6 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"7",
"8"
"8",
"9"
]
},
{
Expand All @@ -74,7 +75,8 @@
"operatingsystem": "OracleLinux",
"operatingsystemrelease": [
"7",
"8"
"8",
"9"
]
},
{
Expand All @@ -88,7 +90,8 @@
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"7",
"8"
"8",
"9"
]
},
{
Expand Down
2 changes: 2 additions & 0 deletions spec/acceptance/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class { 'postgresql::globals':
supported_versions.each do |zabbix_version|
# >= 5.2 server packages are not available for RHEL 7
next if zabbix_version >= '5.2' && default[:platform] == 'el-7-x86_64'
# < 6.0 server packages are not available for RHEL 9
next if zabbix_version < '6.0' && default[:platform] == 'el-9-x86_64'

context "deploys a zabbix #{zabbix_version} server" do
# Using puppet_apply as a helper
Expand Down
6 changes: 5 additions & 1 deletion spec/acceptance/zabbix_application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
supported_versions.each do |zabbix_version|
# Application API was removed in Zabbix 5.4
next if zabbix_version >= '5.4'
# < 6.0 server packages are not available for RHEL 9
next if zabbix_version < '6.0' && default[:platform] == 'el-9-x86_64'

template = case zabbix_version
when '5.0'
Expand All @@ -22,7 +24,9 @@
class { 'apache':
mpm_module => 'prefork',
}
include apache::mod::php
if $facts['os']['family'] != 'RedHat' {
include apache::mod::php
}
class { 'postgresql::globals':
locale => 'en_US.UTF-8',
manage_package_repo => $facts['os']['release']['major'] != '8',
Expand Down
6 changes: 5 additions & 1 deletion spec/acceptance/zabbix_host_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
supported_versions.each do |zabbix_version|
# >= 5.2 server packages are not available for RHEL 7
next if zabbix_version >= '5.2' && default[:platform] == 'el-7-x86_64'
# < 6.0 server packages are not available for RHEL 9
next if zabbix_version < '6.0' && default[:platform] == 'el-9-x86_64'

context "create zabbix_host resources with zabbix version #{zabbix_version}" do
# This will deploy a running Zabbix setup (server, web, db) which we can
Expand All @@ -31,7 +33,9 @@
class { 'apache':
mpm_module => 'prefork',
}
include apache::mod::php
if $facts['os']['family'] != 'RedHat' {
include apache::mod::php
}
class { 'postgresql::globals':
locale => 'en_US.UTF-8',
manage_package_repo => $facts['os']['release']['major'] != '8',
Expand Down
6 changes: 5 additions & 1 deletion spec/acceptance/zabbix_hostgroup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
supported_versions.each do |zabbix_version|
# >= 5.2 server packages are not available for RHEL 7
next if zabbix_version >= '5.2' && default[:platform] == 'el-7-x86_64'
# < 6.0 server packages are not available for RHEL 9
next if zabbix_version < '6.0' && default[:platform] == 'el-9-x86_64'

context "create zabbix_hostgroup resources with zabbix version #{zabbix_version}" do
# This will deploy a running Zabbix setup (server, web, db) which we can
Expand All @@ -15,7 +17,9 @@
class { 'apache':
mpm_module => 'prefork',
}
include apache::mod::php
if $facts['os']['family'] != 'RedHat' {
include apache::mod::php
}
class { 'postgresql::globals':
locale => 'en_US.UTF-8',
manage_package_repo => $facts['os']['release']['major'] != '8',
Expand Down
6 changes: 5 additions & 1 deletion spec/acceptance/zabbix_proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
supported_versions.each do |zabbix_version|
# >= 5.2 server packages are not available for RHEL 7
next if zabbix_version >= '5.2' && default[:platform] == 'el-7-x86_64'
# < 6.0 server packages are not available for RHEL 9
next if zabbix_version < '6.0' && default[:platform] == 'el-9-x86_64'

context "create zabbix_proxy resources with zabbix version #{zabbix_version}" do
# This will deploy a running Zabbix setup (server, web, db) which we can
Expand All @@ -16,7 +18,9 @@
class { 'apache':
mpm_module => 'prefork',
}
include apache::mod::php
if $facts['os']['family'] != 'RedHat' {
include apache::mod::php
}
class { 'postgresql::globals':
locale => 'en_US.UTF-8',
manage_package_repo => $facts['os']['release']['major'] != '8',
Expand Down
6 changes: 5 additions & 1 deletion spec/acceptance/zabbix_template_host_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
next if zabbix_version == '6.0'
# >= 5.2 server packages are not available for RHEL 7
next if zabbix_version >= '5.2' && default[:platform] == 'el-7-x86_64'
# < 6.0 server packages are not available for RHEL 9
next if zabbix_version < '6.0' && default[:platform] == 'el-9-x86_64'

context "create zabbix_template_host resources with zabbix version #{zabbix_version}" do
template = case zabbix_version
Expand All @@ -24,7 +26,9 @@
class { 'apache':
mpm_module => 'prefork',
}
include apache::mod::php
if $facts['os']['family'] != 'RedHat' {
include apache::mod::php
}
class { 'postgresql::globals':
locale => 'en_US.UTF-8',
manage_package_repo => $facts['os']['release']['major'] != '8',
Expand Down
6 changes: 5 additions & 1 deletion spec/acceptance/zabbix_template_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
supported_versions.each do |zabbix_version|
# >= 5.2 server packages are not available for RHEL 7
next if zabbix_version >= '5.2' && default[:platform] == 'el-7-x86_64'
# < 6.0 server packages are not available for RHEL 9
next if zabbix_version < '6.0' && default[:platform] == 'el-9-x86_64'

context "create zabbix_template resources with zabbix version #{zabbix_version}" do
# This will deploy a running Zabbix setup (server, web, db) which we can
Expand All @@ -15,7 +17,9 @@
class { 'apache':
mpm_module => 'prefork',
}
include apache::mod::php
if $facts['os']['family'] != 'RedHat' {
include apache::mod::php
}
class { 'postgresql::globals':
locale => 'en_US.UTF-8',
manage_package_repo => $facts['os']['release']['major'] != '8',
Expand Down
8 changes: 6 additions & 2 deletions spec/classes/agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 3 additions & 3 deletions spec/classes/proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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') }
Expand Down Expand Up @@ -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') }
Expand All @@ -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') }
Expand Down
8 changes: 7 additions & 1 deletion spec/classes/sender_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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') }
Expand All @@ -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

Expand Down
6 changes: 5 additions & 1 deletion spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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') }
Expand Down