Puppet Function: peadm::convert_hash

Defined in:
functions/convert_hash.pp
Function type:
Puppet Language

Summary

converts two arrays into hash

Overview

peadm::convert_hash(Array $keys, Array[Array] $values)Array

Examples:

Using function

peadm::convert_hash(['type', 'status'], [['xl', 'running'], ['large', 'failed']])
[
  { type => xl, status => running}, { type => large, status => failed }
]

Parameters:

  • keys (Array)

    an array of key names to be merged into the hash

  • values (Array[Array])

    data to be merged into an array with the keys

Returns:

  • (Array)


9
10
11
12
13
# File 'functions/convert_hash.pp', line 9

function peadm::convert_hash(Array $keys, Array[Array] $values) >> Array {
  $values.map |$out, $arr| {
    Hash(zip($keys,$arr))
  }
}