Sha256: ce736bada7e4514cdd1e92f3d513c95ff71169ec7ff4e41800ef4a123d3abd48

Contents?: true

Size: 614 Bytes

Versions: 73

Compression:

Stored size: 614 Bytes

Contents

# frozen_string_literal: true

# Aggregates the key/value pairs in the results of a ResultSet into a hash
# mapping the keys to a hash of each distinct value and the list of nodes
# returning that value for the key.
Puppet::Functions.create_function(:'aggregate::nodes') do
  dispatch :aggregate_nodes do
    param 'ResultSet', :resultset
  end

  def aggregate_nodes(resultset)
    resultset.each_with_object({}) do |result, agg|
      result.value.each do |key, val|
        agg[key] ||= {}
        agg[key][val.to_s] ||= []
        agg[key][val.to_s] << result.target.name
      end
      agg
    end
  end
end

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
bolt-1.26.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.25.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.24.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.23.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.22.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.21.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.20.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.19.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.18.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.17.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.16.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.15.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.14.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.13.1 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.13.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.12.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.11.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.10.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.9.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.8.1 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb