From 0327f8e534a912267996e56d804603d53399844f Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Thu, 23 Nov 2023 14:42:53 +0100 Subject: [PATCH] Fix the icingaweb2 modules to run with older puppet-icingaweb2 than 4.0.0 --- manifests/web/director.pp | 10 +++++++--- manifests/web/reporting.pp | 13 ++++++++----- manifests/web/vspheredb.pp | 13 ++++++++----- manifests/web/x509.pp | 13 ++++++++----- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/manifests/web/director.pp b/manifests/web/director.pp index 654607e..1740696 100644 --- a/manifests/web/director.pp +++ b/manifests/web/director.pp @@ -57,6 +57,8 @@ ) { icinga::prepare_web('Director') + $icingaweb2_version = $icinga::web::icingaweb2_version + # # Database # @@ -110,8 +112,10 @@ onlyif => 'systemctl status icinga-director', } - class { 'icingaweb2::module::director::service': - ensure => $service_ensure, - enable => $service_enable, + if versioncmp($icingaweb2_version, '4.0.0') < 0 { + class { 'icingaweb2::module::director::service': + ensure => $service_ensure, + enable => $service_enable, + } } } diff --git a/manifests/web/reporting.pp b/manifests/web/reporting.pp index 442b2c1..72aa227 100644 --- a/manifests/web/reporting.pp +++ b/manifests/web/reporting.pp @@ -49,7 +49,8 @@ icinga::prepare_web('Reporting') - $_db_charset = $db_type ? { + $icingaweb2_version = $icinga::web::icingaweb2_version + $_db_charset = $db_type ? { 'mysql' => 'utf8mb4', default => 'UTF8', } @@ -89,10 +90,12 @@ mail => $mail, } - service { 'icinga-reporting': - ensure => $service_ensure, - enable => $service_enable, - require => Class['icingaweb2::module::reporting'], + if versioncmp($icingaweb2_version, '4.0.0') < 0 { + service { 'icinga-reporting': + ensure => $service_ensure, + enable => $service_enable, + require => Class['icingaweb2::module::reporting'], + } } if defined(Class['icinga::web::monitoring']) { diff --git a/manifests/web/vspheredb.pp b/manifests/web/vspheredb.pp index 604c5c6..9e0a9b4 100644 --- a/manifests/web/vspheredb.pp +++ b/manifests/web/vspheredb.pp @@ -41,7 +41,8 @@ ) { icinga::prepare_web('VSphereDB') - $_db_charset = $db_type ? { + $icingaweb2_version = $icinga::web::icingaweb2_version + $_db_charset = $db_type ? { 'mysql' => 'utf8mb4', default => 'UTF8', } @@ -80,9 +81,11 @@ import_schema => lookup('icingaweb2::module::vspheredb::import_schema', undef, undef, true), } - service { 'icinga-vspheredb': - ensure => $service_ensure, - enable => $service_enable, - require => Class['icingaweb2::module::vspheredb'], + if versioncmp($icingaweb2_version, '4.0.0') < 0 { + service { 'icinga-vspheredb': + ensure => $service_ensure, + enable => $service_enable, + require => Class['icingaweb2::module::vspheredb'], + } } } diff --git a/manifests/web/x509.pp b/manifests/web/x509.pp index 6bbd880..f16cea6 100644 --- a/manifests/web/x509.pp +++ b/manifests/web/x509.pp @@ -43,7 +43,8 @@ fail('Class icinga::web::icingadb or icinga::web::monitoring has to be declared before!') } - $_db_charset = $db_type ? { + $icingaweb2_version = $icinga::web::icingaweb2_version + $_db_charset = $db_type ? { 'mysql' => 'utf8mb4', default => 'UTF8', } @@ -82,9 +83,11 @@ import_schema => lookup('icingaweb2::module::x509::import_schema', undef, undef, true), } - service { 'icinga-x509': - ensure => $service_ensure, - enable => $service_enable, - require => Class['icingaweb2::module::x509'], + if versioncmp($icingaweb2_version, '4.0.0') < 0 { + service { 'icinga-x509': + ensure => $service_ensure, + enable => $service_enable, + require => Class['icingaweb2::module::x509'], + } } }