Skip to content

Commit

Permalink
Remove management of package icingaweb2-module-monitoring on Debian/U…
Browse files Browse the repository at this point in the history
…buntu
  • Loading branch information
lbetz committed Oct 18, 2023
1 parent 0b3acd4 commit 33c105e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 74 deletions.
11 changes: 0 additions & 11 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2489,7 +2489,6 @@ The following parameters are available in the `icingaweb2::module::monitoring` c

* [`ensure`](#-icingaweb2--module--monitoring--ensure)
* [`protected_customvars`](#-icingaweb2--module--monitoring--protected_customvars)
* [`manage_package`](#-icingaweb2--module--monitoring--manage_package)
* [`ido_type`](#-icingaweb2--module--monitoring--ido_type)
* [`ido_host`](#-icingaweb2--module--monitoring--ido_host)
* [`ido_port`](#-icingaweb2--module--monitoring--ido_port)
Expand Down Expand Up @@ -2526,16 +2525,6 @@ that should be hidden in the web interface.

Default value: `['*pw*', '*pass*', 'community']`

##### <a name="-icingaweb2--module--monitoring--manage_package"></a>`manage_package`

Data type: `Boolean`

Set to `false` as Fix for Icinga Web >= 2.12.0 to do not manage the removed package
`icingaweb2-module-monitoring` (only Debian/Ubuntu).
See issue #368 (https://github.com/Icinga/puppet-icingaweb2/issues/368).

Default value: `true`

##### <a name="-icingaweb2--module--monitoring--ido_type"></a>`ido_type`

Data type: `Enum['mysql', 'pgsql']`
Expand Down
25 changes: 1 addition & 24 deletions manifests/module/monitoring.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
# Custom variables in Icinga 2 may contain sensible information. Set patterns for custom variables
# that should be hidden in the web interface.
#
# @param manage_package
# Set to `false` as Fix for Icinga Web >= 2.12.0 to do not manage the removed package
# `icingaweb2-module-monitoring` (only Debian/Ubuntu).
# See issue #368 (https://github.com/Icinga/puppet-icingaweb2/issues/368).
#
# @param ido_type
# Type of your IDO database. Either `mysql` or `pgsql`.
#
Expand Down Expand Up @@ -96,7 +91,6 @@
Enum['absent', 'present'] $ensure = 'present',
Variant[String, Array[String]] $protected_customvars = ['*pw*', '*pass*', 'community'],
Enum['mysql', 'pgsql'] $ido_type = 'mysql',
Boolean $manage_package = true,
Optional[Stdlib::Host] $ido_host = undef,
Optional[Stdlib::Port] $ido_port = undef,
Optional[String] $ido_db_name = undef,
Expand All @@ -120,22 +114,6 @@
$conf_dir = $icingaweb2::globals::conf_dir
$module_conf_dir = "${conf_dir}/modules/monitoring"

case $facts['os']['family'] {
'Debian': {
if $manage_package {
$install_method = 'package'
$package_name = 'icingaweb2-module-monitoring'
} else {
$install_method = 'none'
$package_name = undef
}
}
default: {
$install_method = 'none'
$package_name = undef
}
}

$tls = delete($icingaweb2::config::tls, ['key', 'cert', 'cacert']) + delete_undef_values(icingaweb2::cert::files(
'client',
$module_conf_dir,
Expand Down Expand Up @@ -201,8 +179,7 @@

icingaweb2::module { 'monitoring':
ensure => $ensure,
install_method => $install_method,
package_name => $package_name,
install_method => 'none',
settings => $settings,
}
}
6 changes: 3 additions & 3 deletions spec/classes/doc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
facts
end

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
let(:install_method) { 'package' }
let(:package_name) { 'icingaweb2-module-doc' }
Expand All @@ -33,7 +33,7 @@
.with_ensure('present')
}

if facts[:osfamily] == 'Debian'
if facts[:os]['family'] == 'Debian'
it { is_expected.to contain_package('icingaweb2-module-doc').with('ensure' => 'installed') }
end
end
Expand All @@ -49,7 +49,7 @@
.with_ensure('absent')
}

if facts[:osfamily] == 'Debian'
if facts[:os]['family'] == 'Debian'
it { is_expected.to contain_package('icingaweb2-module-doc').with('ensure' => 'installed') }
end
end
Expand Down
36 changes: 2 additions & 34 deletions spec/classes/monitoring_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@
facts
end

case facts[:osfamily]
when 'Debian'
let(:install_method) { 'package' }
let(:package_name) { 'icingaweb2-module-monitoring' }
else
let(:install_method) { 'none' }
let(:package_name) { nil }
end

context "#{os} with ido_type 'mysql' and commandtransport 'api'" do
let(:params) do
{ ido_type: 'mysql',
Expand All @@ -39,8 +30,7 @@

it {
is_expected.to contain_icingaweb2__module('monitoring')
.with_install_method(install_method)
.with_package_name(package_name)
.with_install_method('none')
.with_module_dir('/usr/share/icingaweb2/modules/monitoring')
.with_settings('module-monitoring-backends' => {
'section_name' => 'backends',
Expand Down Expand Up @@ -93,8 +83,7 @@

it do
is_expected.to contain_icingaweb2__module('monitoring')
.with_install_method(install_method)
.with_package_name(package_name)
.with_install_method('none')
.with_module_dir('/usr/share/icingaweb2/modules/monitoring')
.with_settings('module-monitoring-backends' => {
'section_name' => 'backends',
Expand Down Expand Up @@ -123,33 +112,12 @@
.with_password('icinga2')
}

if facts[:osfamily] == 'Debian'
it { is_expected.to contain_package('icingaweb2-module-monitoring').with('ensure' => 'installed') }
end

it {
is_expected.to contain_icingaweb2__module__monitoring__commandtransport('foo')
.with_transport('local')
}
end

context "#{os} with manage_package 'false'" do
let(:params) do
{ ido_type: 'mysql',
ido_host: 'localhost',
ido_db_name: 'icinga2',
ido_db_username: 'icinga2',
ido_db_password: 'icinga2',
manage_package: false }
end

it {
is_expected.to contain_icingaweb2__module('monitoring')
.with_install_method('none')
.with_module_dir('/usr/share/icingaweb2/modules/monitoring')
}
end

context "#{os} with invalid ido_type" do
let(:params) { { ido_type: 'foobar' } }

Expand Down
4 changes: 2 additions & 2 deletions spec/classes/translation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
})
}

case facts[:osfamily]
case facts[:os]['family']
when 'Debian', 'RedHat'
it { is_expected.to contain_package('gettext').with('ensure' => 'present') }
when 'Suse'
Expand All @@ -50,7 +50,7 @@
.with_module_dir('/usr/share/icingaweb2/modules/translation')
}

case facts[:osfamily]
case facts[:os]['family']
when 'Debian', 'RedHat'
it { is_expected.to contain_package('gettext').with('ensure' => 'absent') }
when 'Suse'
Expand Down

0 comments on commit 33c105e

Please sign in to comment.