Ask Your Question

hiera yaml does this make a string or an array?

asked 2015-02-24 18:22:04 -0600

Red Cricket gravatar image

updated 2015-02-24 18:22:30 -0600


suppose I have in my hiera data this

- rabbit_01
- rabbit_02
thing_one::rabbit_nodes: "%{hiera('rabbit_nodes')}"

Will thing_one::rabbit_nodes be an arrary or a string?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-02-24 22:13:16 -0600

GregLarkin gravatar image

The values came out as a YAML array for me, whether I looked up rabbit_nodes or thing_one::rabbit_nodes:

# hiera -c ../hiera.yaml thing_one::rabbit_nodes
["rabbit_01", "rabbit_02"]

Are you seeing different behavior there?

edit flag offensive delete link more


Nice. I should of thought of using command like hiera to test.

Red Cricket gravatar imageRed Cricket ( 2015-02-24 23:27:02 -0600 )edit

I don't think this works properly - the resulting value is actually a string. This is a known issue (, and Hiera 2.0 introduces the %{alias()} function that will properly maintain the type. You could workaround it with stdlib's `parseyaml` function.

Nick gravatar imageNick ( 2015-03-03 03:22:30 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-02-24 18:22:04 -0600

Seen: 1,034 times

Last updated: Feb 24 '15