Hiera lookups in Ruby code

893 views
Skip to first unread message

Dirk Heinrichs

unread,
Apr 14, 2014, 11:55:05 AM4/14/14
to puppet...@googlegroups.com
Hi,

is it possible to do Hiera lookups inside Ruby code, for example in a provider for a new resource type? If so, how?

Thanks...

    Dirk
--

Dirk Heinrichs, Senior Systems Engineer, Engineering Solutions
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Tel: +49 2226 1596666 (Ansage) 1149
Email: d...@recommind.com
Skype: dirk.heinrichs.recommind
www.recommind.com

Felix Frank

unread,
Apr 14, 2014, 12:28:10 PM4/14/14
to puppet...@googlegroups.com
Hi,

basically you need to mimic the behavior of Puppet's own hiera()
function to talk to hiera's ruby API, see
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/parser/functions/hiera.rb#L23

Perhaps even more interesting, the way the hiera CLI tool uses the API,
https://github.com/puppetlabs/hiera/blob/master/bin/hiera#L249

HTH,
Felix
Reply all
Reply to author
Forward
0 new messages