4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'vendor_modules/stdlib/functions/ensure.pp', line 4
function stdlib::ensure(
Variant[Boolean, Enum['present', 'absent']] $ensure,
Optional[Enum['directory', 'link', 'mounted', 'service', 'file', 'package']] $resource = undef,
) >> String {
$_ensure = $ensure ? {
Boolean => $ensure.bool2str('present', 'absent'),
default => $ensure,
}
case $resource {
'package': {
$_ensure ? {
'present' => 'installed',
default => 'absent',
}
}
'service': {
$_ensure ? {
'present' => 'running',
default => 'stopped',
}
}
undef: { $_ensure }
default: {
$_ensure ? {
'present' => $resource,
default => $_ensure,
}
}
}
}
|