Ask Your Question
1

hiera yaml does this make a string or an array?

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

Red Cricket gravatar image

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

Hi,

suppose I have in my hiera data this

rabbit_nodes:
- 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
1

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

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

Comments

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

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

I don't think this works properly - the resulting value is actually a string. This is a known issue (https://tickets.puppetlabs.com/browse/HI-183), 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 -0500 )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

Stats

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

Seen: 362 times

Last updated: Feb 24 '15