Skip to content

Commit

Permalink
Merge pull request #95 from Icinga/fix/icingaweb2-v4
Browse files Browse the repository at this point in the history
Fix the icingaweb2 modules to run with older puppet-icingaweb2 than 4…
  • Loading branch information
lbetz authored Nov 23, 2023
2 parents 1235fce + 0327f8e commit a2e0589
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
10 changes: 7 additions & 3 deletions manifests/web/director.pp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
) {
icinga::prepare_web('Director')

$icingaweb2_version = $icinga::web::icingaweb2_version

#
# Database
#
Expand Down Expand Up @@ -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,
}
}
}
13 changes: 8 additions & 5 deletions manifests/web/reporting.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
Expand Down Expand Up @@ -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']) {
Expand Down
13 changes: 8 additions & 5 deletions manifests/web/vspheredb.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
Expand Down Expand Up @@ -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'],
}
}
}
13 changes: 8 additions & 5 deletions manifests/web/x509.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
Expand Down Expand Up @@ -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'],
}
}
}

0 comments on commit a2e0589

Please sign in to comment.