Puppet Function: cd4peadm::checks::aggregate_results

Defined in:
lib/puppet/functions/cd4peadm/checks/aggregate_results.rb
Function type:
Ruby 4.x API

Overview

cd4peadm::checks::aggregate_results(Array $results)Hash

Aggregates check results (validate, preflight, or other)

Parameters:

  • results (Array)

    array of check results from various check plans

Returns:

  • (Hash)


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/puppet/functions/cd4peadm/checks/aggregate_results.rb', line 2

Puppet::Functions.create_function(:'cd4peadm::checks::aggregate_results') do
    # Aggregates check results (validate, preflight, or other)
    # @param [Array] results array of check results from various check plans
    # @returns [Hash] aggregated results
    dispatch :aggregate_results do
        param 'Array', :results
        return_type 'Hash'
    end

    def aggregate_results(results)
        aggregated = { 'passed' => [], 'failed' => []}
        results.each do |result|
            aggregated['passed'].concat(result['passed'])
            aggregated['failed'].concat(result['failed'])
        end
        aggregated
    end
end