19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'manifests/feature/icingadb.pp', line 19
class icinga2::feature::icingadb(
Enum['absent', 'present'] $ensure = present,
Optional[Stdlib::Host] $host = undef,
Optional[Stdlib::Port::Unprivileged] $port = undef,
Optional[Stdlib::Absolutepath] $socket_path = undef,
Optional[String] $password = undef,
) {
if ! defined(Class['::icinga2']) {
fail('You must include the icinga2 base class before using any icinga2 feature class!')
}
$conf_dir = $::icinga2::globals::conf_dir
$_notify = $ensure ? {
'present' => Class['::icinga2::service'],
default => undef,
}
# The password parameter isn't parsed anymore.
if $password {
$_password = "-:\"${password}\""
} else {
$_password = undef
}
# compose attributes
$attrs = {
host => $host,
port => $port,
path => $socket_path,
password => $_password,
}
# create object
icinga2::object { 'icinga2::object::IcingaDB::icingadb':
object_name => 'icingadb',
object_type => 'IcingaDB',
attrs => delete_undef_values($attrs),
attrs_list => keys($attrs),
target => "${conf_dir}/features-available/icingadb.conf",
order => 10,
notify => $_notify,
}
# manage feature
icinga2::feature { 'icingadb':
ensure => $ensure,
}
}
|