Skip to content

Commit 25396e3

Browse files
authored
Merge pull request #276 from rwaffen/update_outputs
fix: use filter_set and then the `.names` methode
2 parents 7c1d093 + 7fdc207 commit 25396e3

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

plans/patch_batch.pp

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
# get nodes that are 'clean' from health check results
5858
$nodes_to_patch = ($health_checks.filter_set |$item| { $item.value['state'] == 'clean' }).map |$n| { $n.target }
59-
$health_check_failed = ($health_checks.filter_set |$item| { $item.status == 'failure' }).map |$n| { $n.name }.sort
59+
$health_check_failed = ($health_checks.filter_set |$item| { $item.status == 'failure' }).names
6060

6161
if $debug {
6262
out::message('patch_batch.pp: Nodes to patch after health check:')
@@ -85,22 +85,13 @@
8585
out::message($patching_result)
8686
}
8787

88-
$no_patches = $patching_result.ok_set.filter |$item| {
89-
$item.value['packages_updated'].empty
90-
}.map |$n| { $n.name }.sort
91-
92-
$with_patches = $patching_result.ok_set.filter |$item| {
93-
! $item.value['packages_updated'].empty
94-
}.map |$n| { $n.name }.sort
95-
96-
$reboot_required = $patching_result.ok_set.filter |$item| {
97-
$item.value['reboot_required'] == true
98-
}.map |$n| { $n.name }.sort
99-
100-
$targets = get_targets($batch).map |$t| { $t.name }.sort
88+
$no_patches = $patching_result.ok_set.filter_set |$item| { $item.value['packages_updated'].empty }.names
89+
$with_patches = $patching_result.ok_set.filter_set |$item| { ! $item.value['packages_updated'].empty }.names
90+
$reboot_required = $patching_result.ok_set.filter_set |$item| { $item.value['reboot_required'] == true }.names
91+
$targets = get_targets($batch).map |$t| { $t.name }.sort
10192

10293
$output = {
103-
failed => $patching_result.error_set.map |$n| { $n.name }.sort,
94+
failed => $patching_result.error_set.names,
10495
health_check => $run_health_check,
10596
health_check_failed => $health_check_failed,
10697
no_patches => $no_patches,

0 commit comments

Comments
 (0)