Bump the rest of the of the acceptance tests to 5.0
MODIFY
manifests/database/mysql.pp
manifests/database/mysql.pp
@@ -30,7 +30,7 @@ class zabbix::database::mysql (
#
# Adjustments for version 3.x/4.x/5.x - structure of package with sqls differs from previous versions
case $zabbix_version {
- /^(3|4|5).\d+$/: {
+ /^[345].\d+$/: {
if ($database_schema_path == false) or ($database_schema_path == '') {
$schema_path = '/usr/share/doc/zabbix-*-mysql*'
}

MODIFY
manifests/database/postgresql.pp
manifests/database/postgresql.pp
@@ -30,7 +30,7 @@ class zabbix::database::postgresql (
#
# Adjustments for version 3.x/4.x/5.x - structure of package with sqls differs from previous versions
case $zabbix_version {
- /^(3|4|5).\d+$/: {
+ /^[345].\d+$/: {
if ($database_schema_path == false) or ($database_schema_path == '') {
case $facts['os']['name'] {
'CentOS', 'RedHat', 'OracleLinux', 'VirtuozzoLinux': {

MODIFY
manifests/web.pp
manifests/web.pp
@@ -237,6 +237,14 @@ class zabbix::web (
fail("${facts['os']['family']} is currently not supported for zabbix::web")
}
+ # zabbix frontend 5.x is not supported, among others, on stretch and xenial.
+ # https://www.zabbix.com/documentation/current/manual/installation/frontend/frontend_on_debian
+ if $facts['os']['name'] in ['ubuntu', 'debian'] and versioncmp($zabbix_version, '5') >= 0 {
+ if versioncmp($facts['os']['release']['major'], '16.04') == 0 or versioncmp($facts['os']['release']['major'], '9') == 0 {
+ fail("${facts['os']['family']} ${$facts['os']['release']['major']} is not supported for zabbix::web")
+ }
+ }
+
# Only include the repo class if it has not yet been included
unless defined(Class['Zabbix::Repo']) {
class { 'zabbix::repo':
@@ -279,7 +287,10 @@ class zabbix::web (
'3.4' : {
$zabbixapi_version = '4.0.0'
}
- /^4\.\d{1}$/: {
+ /^4\.[02]$/: {
+ $zabbixapi_version = '4.1.2'
+ }
+ '4.4': {
$zabbixapi_version = '4.2.0'
}
default : {
@@ -345,7 +356,7 @@ class zabbix::web (
}
'CentOS', 'RedHat': {
$zabbix_web_package = 'zabbix-web'
- if ($facts['os']['release']['major'] == '7' and $zabbix_version == '5.0') {
+ if ($facts['os']['release']['major'] == '7' and versioncmp($zabbix_version, '5') >= 0) {
package { 'zabbix-required-scl-repo':
ensure => 'latest',
name => 'centos-release-scl',
@@ -403,6 +414,17 @@ class zabbix::web (
content => template('zabbix/web/zabbix.conf.php.erb'),
}
+ # For API to work on Zabbix 5.x zabbix.conf.php needs to be in the root folder.
+ if versioncmp($zabbix_version, '5') >= 0 {
+ file { '/etc/zabbix/zabbix.conf.php':
+ ensure => link,
+ target => '/etc/zabbix/web/zabbix.conf.php',
+ owner => $web_config_owner,
+ group => $web_config_group,
+ mode => '0640',
+ }
+ }
+
# Is set to true, it will create the apache vhost.
if $manage_vhost {
include apache

MODIFY
spec/acceptance/zabbix_application_spec.rb
spec/acceptance/zabbix_application_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
# rubocop:disable RSpec/LetBeforeExamples
-describe 'zabbix_application type', unless: default[:platform] =~ %r{debian-10-amd64} do
+describe 'zabbix_application type', unless: default[:platform] =~ %r{(ubuntu-16.04|debian-9|debian-10)-amd64} do
context 'create zabbix_application resources' do
# This will deploy a running Zabbix setup (server, web, db) which we can
# use for custom type tests

MODIFY
spec/acceptance/zabbix_host_spec.rb
spec/acceptance/zabbix_host_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
# rubocop:disable RSpec/LetBeforeExamples
-describe 'zabbix_host type', unless: default[:platform] =~ %r{debian-10-amd64} do
+describe 'zabbix_host type', unless: default[:platform] =~ %r{(ubuntu-16.04|debian-9|debian-10)-amd64} do
context 'create zabbix_host resources' do
# This will deploy a running Zabbix setup (server, web, db) which we can
# use for custom type tests
@@ -20,7 +20,7 @@ class { 'postgresql::globals':
-> class { 'postgresql::server': }
class { 'zabbix':
- zabbix_version => '4.4',
+ zabbix_version => '5.0',
zabbix_url => 'localhost',
zabbix_api_user => 'Admin',
zabbix_api_pass => 'zabbix',

MODIFY
spec/acceptance/zabbix_hostgroup_spec.rb
spec/acceptance/zabbix_hostgroup_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
# rubocop:disable RSpec/LetBeforeExamples
-describe 'zabbix_hostgroup type', unless: default[:platform] =~ %r{debian-10-amd64} do
+describe 'zabbix_hostgroup type', unless: default[:platform] =~ %r{(ubuntu-16.04|debian-9|debian-10)-amd64} do
context 'create zabbix_hostgroup resources' do
it 'runs successfully' do
# This will deploy a running Zabbix setup (server, web, db) which we can
@@ -21,7 +21,7 @@ describe 'zabbix_hostgroup type', unless: default[:platform] =~ %r{debian-10-amd
-> class { 'postgresql::server': }
class { 'zabbix':
- zabbix_version => '4.4',
+ zabbix_version => '5.0',
zabbix_url => 'localhost',
zabbix_api_user => 'Admin',
zabbix_api_pass => 'zabbix',

MODIFY
spec/acceptance/zabbix_proxy_spec.rb
spec/acceptance/zabbix_proxy_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
# rubocop:disable RSpec/LetBeforeExamples
-describe 'zabbix_proxy type', unless: default[:platform] =~ %r{debian-10-amd64} do
+describe 'zabbix_proxy type', unless: default[:platform] =~ %r{(ubuntu-16.04|debian-9|debian-10)-amd64} do
context 'create zabbix_proxy resources' do
# This will deploy a running Zabbix setup (server, web, db) which we can
# use for custom type tests
@@ -20,7 +20,7 @@ describe 'zabbix_proxy type', unless: default[:platform] =~ %r{debian-10-amd64}
-> class { 'postgresql::server': }
class { 'zabbix':
- zabbix_version => '4.4',
+ zabbix_version => '5.0',
zabbix_url => 'localhost',
zabbix_api_user => 'Admin',
zabbix_api_pass => 'zabbix',

MODIFY
spec/acceptance/zabbix_template_host_spec.rb
spec/acceptance/zabbix_template_host_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
# rubocop:disable RSpec/LetBeforeExamples
-describe 'zabbix_template_host type', unless: default[:platform] =~ %r{debian-10-amd64} do
+describe 'zabbix_template_host type', unless: default[:platform] =~ %r{(ubuntu-16.04|debian-9|debian-10)-amd64} do
context 'create zabbix_template_host resources' do
it 'runs successfully' do
# This will deploy a running Zabbix setup (server, web, db) which we can
@@ -21,7 +21,7 @@ describe 'zabbix_template_host type', unless: default[:platform] =~ %r{debian-10
-> class { 'postgresql::server': }
class { 'zabbix':
- zabbix_version => '4.4',
+ zabbix_version => '5.0',
zabbix_url => 'localhost',
zabbix_api_user => 'Admin',
zabbix_api_pass => 'zabbix',

MODIFY
spec/acceptance/zabbix_template_spec.rb
spec/acceptance/zabbix_template_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper_acceptance'
require 'serverspec_type_zabbixapi'
# rubocop:disable RSpec/LetBeforeExamples
-describe 'zabbix_template type', unless: default[:platform] =~ %r{debian-10-amd64} do
+describe 'zabbix_template type', unless: default[:platform] =~ %r{(ubuntu-16.04|debian-9|debian-10)-amd64} do
context 'create zabbix_template resources' do
it 'runs successfully' do
# This will deploy a running Zabbix setup (server, web, db) which we can
@@ -21,7 +21,7 @@ describe 'zabbix_template type', unless: default[:platform] =~ %r{debian-10-amd6
-> class { 'postgresql::server': }
class { 'zabbix':
- zabbix_version => '4.4',
+ zabbix_version => '5.0',
zabbix_url => 'localhost',
zabbix_api_user => 'Admin',
zabbix_api_pass => 'zabbix',

MODIFY
spec/support/acceptance/prepare_host.rb
spec/support/acceptance/prepare_host.rb
@@ -11,7 +11,13 @@ def prepare_host
/opt/puppetlabs/bin/puppet resource service zabbix-server ensure=stopped
/opt/puppetlabs/bin/puppet resource package zabbix-server-pgsql ensure=purged
/opt/puppetlabs/bin/puppet resource package zabbix-server-pgsql-scl ensure=purged
+ /opt/puppetlabs/bin/puppet resource package zabbix-server-mysql ensure=purged
+ /opt/puppetlabs/bin/puppet resource package zabbix-server-mysql-scl ensure=purged
/opt/puppetlabs/bin/puppet resource package zabbix-web ensure=purged
+ /opt/puppetlabs/bin/puppet resource package zabbix-web-pgsql ensure=purged
+ /opt/puppetlabs/bin/puppet resource package zabbix-web-mysql ensure=purged
+ /opt/puppetlabs/bin/puppet resource package zabbix-web-pgsql-scl ensure=purged
+ /opt/puppetlabs/bin/puppet resource package zabbix-web-mysql-scl ensure=purged
/opt/puppetlabs/bin/puppet resource package zabbix-frontend-php ensure=purged
rm -f /etc/zabbix/.*done
if id postgres > /dev/null 2>&1; then

Bump the rest of the of the acceptance tests to 5.0

Signed-off-by: Christos Papageorgiou <root.expert.xda@gmail.com>