Puppet Plan: patching::pre_post_update
- Defined in:
-
plans/pre_post_update.pp
Summary
Common entry point for executing the pre/post update custom scripts
Overview
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
|
# File 'plans/pre_post_update.pp', line 22
plan patching::pre_post_update (
TargetSpec $targets,
String[1] $task,
Optional[String[1]] $script_linux = undef,
Optional[String[1]] $script_windows = undef,
Boolean $noop = false,
) {
out::message("pre_post_update - noop = ${noop}")
$_targets = run_plan('patching::get_targets', $targets)
# split into linux vs Windows
$targets_linux = $_targets.filter |$t| { facts($t)['os']['family'] != 'windows' }
$targets_windows = $_targets.filter |$t| { facts($t)['os']['family'] == 'windows' }
# run pre-patch scripts
if !$targets_linux.empty() {
$results_linux = run_task($task, $targets_linux,
script => $script_linux,
_noop => $noop).results
}
else {
$results_linux = []
}
if !$targets_windows.empty() {
$results_windows = run_task($task, $targets_windows,
script => $script_windows,
_noop => $noop).results
}
else {
$results_windows = []
}
# TODO pretty print any scripts that were run
return ResultSet($results_linux + $results_windows)
}
|