Skip to content

Commit 3924c9b

Browse files
committed
Support for Zabbix 7.2
1 parent ee8d31f commit 3924c9b

File tree

10 files changed

+58
-17
lines changed

10 files changed

+58
-17
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ jobs:
2121
name: Puppet
2222
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v3
2323
with:
24-
beaker_facter: 'zabbix_version:Zabbix:5.0,6.0,7.0'
24+
beaker_facter: 'zabbix_version:Zabbix:5.0,6.0,7.0,7.2'
2525
unit_runs_on: 'cern-self-hosted'

.sync.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ spec/spec_helper.rb:
1313
- parameter_documentation
1414
.github/workflows/ci.yml:
1515
with:
16-
beaker_facter: 'zabbix_version:Zabbix:5.0,6.0,7.0'
16+
beaker_facter: 'zabbix_version:Zabbix:5.0,6.0,7.0,7.2'
1717
unit_runs_on: 'cern-self-hosted'

manifests/database/mysql.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
assert_private()
2525

2626
if ($database_schema_path == false) or ($database_schema_path == '') {
27-
if versioncmp($zabbix_version, '6.0') >= 0 {
27+
if versioncmp($zabbix_version, '7.2') >= 0 {
28+
$schema_path = '/usr/share/zabbix/sql-scripts/mysql/'
29+
} elsif versioncmp($zabbix_version, '6.0') >= 0 {
2830
$schema_path = '/usr/share/zabbix-sql-scripts/mysql/'
2931
} else {
3032
$schema_path = '/usr/share/doc/zabbix-*-mysql*'

manifests/database/postgresql.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525

2626
if $database_schema_path != false and $database_schema_path != '' {
2727
$schema_path = $database_schema_path
28-
} elsif versioncmp($zabbix_version, '6.0') >= 0 {
28+
} elsif versioncmp($zabbix_version, '7.2') >= 0 {
29+
$schema_path = '/usr/share/zabbix/sql-scripts/postgresql/'
30+
} elsif versioncmp($zabbix_version, '6.0') >= 0 {
2931
$schema_path = '/usr/share/zabbix-sql-scripts/postgresql/'
3032
} elsif $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '7' {
3133
$schema_path = "/usr/share/doc/zabbix-*-pgsql-${zabbix_version}*/"

manifests/repo.pp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@
3737
}
3838

3939
$_repo_location = $repo_location ? {
40-
undef => "https://repo.zabbix.com/zabbix/${zabbix_version}/rhel/${majorrelease}/\$basearch/",
40+
undef => versioncmp($zabbix_version, '7.2') ? {
41+
# Version older than 7.2
42+
-1 => "https://repo.zabbix.com/zabbix/${zabbix_version}/rhel/${majorrelease}/\$basearch/",
43+
# Version 7.2 and newer
44+
default => "https://repo.zabbix.com/zabbix/${zabbix_version}/stable/rhel/${majorrelease}/\$basearch/",
45+
},
4146
default => $repo_location,
4247
}
4348

@@ -87,7 +92,12 @@
8792
}
8893

8994
$_repo_location = $repo_location ? {
90-
undef => "http://repo.zabbix.com/zabbix/${zabbix_version}/${operatingsystem}/",
95+
undef => versioncmp($zabbix_version, '7.2') ? {
96+
# Version older than 7.2
97+
-1 => "http://repo.zabbix.com/zabbix/${zabbix_version}/${operatingsystem}/",
98+
# Version 7.2 and newer
99+
default => "http://repo.zabbix.com/zabbix/${zabbix_version}/stable/${operatingsystem}/",
100+
},
91101
default => $repo_location,
92102
}
93103

manifests/web.pp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,13 @@
258258

259259
# Is set to true, it will create the apache vhost.
260260
if $manage_vhost {
261+
$zabbix_ui_dir = versioncmp($zabbix_version, '7.2') ? {
262+
# Version older than 7.2
263+
-1 => '/usr/share/zabbix',
264+
# Version 7.2 and newer
265+
default => '/usr/share/zabbix/ui',
266+
}
267+
261268
include apache
262269
include apache::mod::dir
263270
if $facts['os']['family'] == 'RedHat' {
@@ -277,7 +284,7 @@
277284
}
278285

279286
$fcgi_filematch = {
280-
path => '/usr/share/zabbix',
287+
path => $zabbix_ui_dir,
281288
provider => 'directory',
282289
addhandlers => [
283290
{
@@ -319,7 +326,7 @@
319326
# We create nonssl vhost for redirecting non ssl
320327
# traffic to https.
321328
apache::vhost { "${zabbix_url}_nonssl":
322-
docroot => '/usr/share/zabbix',
329+
docroot => $zabbix_ui_dir,
323330
manage_docroot => false,
324331
default_vhost => $default_vhost,
325332
port => $apache_listenport,
@@ -344,35 +351,35 @@
344351
}
345352

346353
apache::vhost { $zabbix_url:
347-
docroot => '/usr/share/zabbix',
354+
docroot => $zabbix_ui_dir,
348355
ip => $apache_listen_ip,
349356
port => $apache_listen_port,
350357
default_vhost => $default_vhost,
351358
add_listen => true,
352359
directories => [
353360
merge({
354-
path => '/usr/share/zabbix',
361+
path => $zabbix_ui_dir,
355362
provider => 'directory',
356363
require => 'all granted',
357364
}, $fcgi_filematch
358365
),
359366
{
360-
path => '/usr/share/zabbix/conf',
367+
path => "${zabbix_ui_dir}/conf",
361368
provider => 'directory',
362369
require => 'all denied',
363370
},
364371
{
365-
path => '/usr/share/zabbix/api',
372+
path => "${zabbix_ui_dir}/api",
366373
provider => 'directory',
367374
require => 'all denied',
368375
},
369376
{
370-
path => '/usr/share/zabbix/include',
377+
path => "${zabbix_ui_dir}/include",
371378
provider => 'directory',
372379
require => 'all denied',
373380
},
374381
{
375-
path => '/usr/share/zabbix/include/classes',
382+
path => "${zabbix_ui_dir}/include/classes",
376383
provider => 'directory',
377384
require => 'all denied',
378385
},

spec/classes/database_mysql_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323

2424
supported_versions.each do |zabbix_version|
2525
# path to sql files on Debian and RedHat
26-
path = if Puppet::Util::Package.versioncmp(zabbix_version, '6.0') >= 0
26+
path = if Puppet::Util::Package.versioncmp(zabbix_version, '7.2') >= 0
27+
'/usr/share/zabbix/sql-scripts/mysql/'
28+
elsif Puppet::Util::Package.versioncmp(zabbix_version, '6.0') >= 0
2729
'/usr/share/zabbix-sql-scripts/mysql/'
2830
else
2931
'/usr/share/doc/zabbix-*-mysql*'

spec/classes/database_postgresql_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
end
2929

3030
supported_versions.each do |zabbix_version|
31-
path = if Puppet::Util::Package.versioncmp(zabbix_version, '6.0') >= 0
31+
path = if Puppet::Util::Package.versioncmp(zabbix_version, '7.2') >= 0
32+
'/usr/share/zabbix/sql-scripts/postgresql/'
33+
elsif Puppet::Util::Package.versioncmp(zabbix_version, '6.0') >= 0
3234
'/usr/share/zabbix-sql-scripts/postgresql/'
3335
else
3436
'/usr/share/doc/zabbix-*-pgsql'

spec/classes/repo_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,22 @@
137137
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005') } if facts[:os]['release']['major'].to_i < 9
138138
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD') } if facts[:os]['release']['major'].to_i >= 9
139139
end
140+
141+
context "on RedHat #{major} and Zabbix 7.2" do
142+
let :params do
143+
{
144+
zabbix_version: '7.2',
145+
manage_repo: true
146+
}
147+
end
148+
149+
it { is_expected.to contain_yumrepo('zabbix').with_baseurl("https://repo.zabbix.com/zabbix/7.2/stable/rhel/#{major}/$basearch/") }
150+
it { is_expected.to contain_yumrepo('zabbix').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005') }
151+
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_baseurl("https://repo.zabbix.com/non-supported/rhel/#{major}/$basearch/") }
152+
153+
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-B5333005') } if facts[:os]['release']['major'].to_i < 9
154+
it { is_expected.to contain_yumrepo('zabbix-nonsupported').with_gpgkey('https://repo.zabbix.com/RPM-GPG-KEY-ZABBIX-08EFA7DD') } if facts[:os]['release']['major'].to_i >= 9
155+
end
140156
end
141157
end
142158
end

spec/support/acceptance/supported_versions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
def supported_versions
4-
supported_versions = %w[5.0 6.0 7.0]
4+
supported_versions = %w[5.0 6.0 7.0 7.2]
55
# this is a hack so that we don't have to rewrite the existing acceptance tests
66
if (beaker_zabbix_version = ENV.fetch('BEAKER_FACTER_zabbix_version', nil))
77
supported_versions &= [beaker_zabbix_version]

0 commit comments

Comments
 (0)