Puppet Function: peadm::determine_status
- Defined in:
- functions/determine_status.pp
- Function type:
- Puppet Language
Summary
Produces a summarized hash of the given status dataOverview
}
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'functions/determine_status.pp', line 48
function peadm::determine_status(Array $status_data, Boolean $use_colors = true) >> Hash {
# convert the data into a hash with the sevice names as the keys
$hash_data = $status_data.reduce({}) | $res, $data | {
stdlib::merge($res, { $data[service] => $data })
}
$out = $hash_data.reduce({}) | $res, $svc_data | {
$service_name = $svc_data[0]
$server = $svc_data[1][server]
stdlib::merge($res, { "${service_name}/${server}" => $svc_data[1][state] == 'running' })
}
$bad_status = $out.filter | $item | { ! $item[1] }
$passed_status = $out.filter | $item | { $item[1] }
$overall_status = peadm::convert_status($bad_status.count, $out.count, $use_colors)
return { status => $overall_status, state => $out, failed => $bad_status, passed => $passed_status }
}
|