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.42.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.41.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.40.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.39.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.38.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.37.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.36.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.35.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.34.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.33.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.32.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.31.1 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.31.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.30.1 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.30.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.29.1 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.29.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.28.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.27.1 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb
bolt-1.27.0 modules/aggregate/lib/puppet/functions/aggregate/nodes.rb