Recursive hiera lookups with Arrays and Hashes

174 views
Skip to first unread message

Trevor Vaughan

unread,
May 4, 2014, 12:04:39 PM5/4/14
to puppet...@googlegroups.com
All,

I've just patched Hiera to allow recursive lookups of Arrays and Hashes.


For my uses, this patch works properly, however, it hasn't gotten buy off from the Hiera team yet.

This allows you to do the following:

---
foo :
  - 'one'
  - 'two'

bar : %{hiera('foo')}

Result:

hiera foo => [ 'one', 'two' ]
hiera bar => ['one', 'two' ]

There is no merging of arrays or hashes if you nest the entries and if you use an array entry on the left hand side of a lookup you'll probably end up with a Hiera entry that you can't reference.

Thanks,

Trevor

--
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
tvau...@onyxpoint.com

-- This account not approved for unencrypted proprietary information --

Trevor Vaughan

unread,
May 4, 2014, 2:47:30 PM5/4/14
to puppet...@googlegroups.com
All,

Apologies for this, but apparently, the patch that I put together is stopping one level too high on some queries.

Pleas disregard.

Thanks,

Trevor

Trevor Vaughan

unread,
May 4, 2014, 5:17:47 PM5/4/14
to puppet...@googlegroups.com
Well, that was fun.

This has been corrected and validated against the internal Hiera spec tests. All should be well if you wish to use the patch!


Thanks!

Trevor

Dan Bode

unread,
May 4, 2014, 8:21:20 PM5/4/14
to public puppet users
thanks for your work on this, it was already on my TODO list. I will definitely be looking at this patch in the near future.


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CANs%2BFoWdCC2vKmYqLxoBeUk2oSWpHSacB_3Mpsw%2B8D277fHnCg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Trevor Vaughan

unread,
May 4, 2014, 10:29:38 PM5/4/14
to puppet...@googlegroups.com
Thanks Dan.

I just confirmed that it works as expected on a full system called from Puppet.

I'm not sure if bailing at the first hit was the right thing to do, but it made sense to me.

Trevor



For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages