I have a hiera_hash that looks like this:
signalfx_custom_receivers:
smartagent/http1:
type: http
host: "es.mydomain.tv"
useHTTPS: true
smartagent/http2:
type: http
host: "es.other.tv"
useHTTPS: true
smartagent/http3:
type: http
host: "pmd-akamai.cdn.mydomain.tv"
useHTTPS: true
I'm trying to generate an array from this to use elsewhere. The array should only contain smartagent values, so should looks like this:
[smartagent/http1, smartagent/http2, smartagent/http3]
I've tried the following:
$signalfx_custom_pipeline = Array($signalfx_custom_receivers)
However, this includes all of the nested key/values, and ends up looking like this:
[["smartagent/http1", {"type"=>"http", "host"=>"es.mydomain.tv", "useHTTPS"=>true}], ["smartagent/http2", {"type"=>"http", "host"=>"es.other.tv", "useHTTPS"=>true}], ["smartagent/http3", {"type"=>"http", "host"=>"pmd-akamai.cdn.mydomain.tv", "useHTTPS"=>true}]]
How can I generate an array, but avoid adding these nested values?
That is, the keys of the hash. Extracting these is exactly what the built-in
keys()function does:The two forms behave identically, but personally, I find the second clearer in this case.