Quantcast
Channel: Ask Puppet: Puppet DevOps Q&A Community - RSS feed
Viewing all articles
Browse latest Browse all 257

Hiera custom backend not working

$
0
0
Hey, I'm trying to write a custom hiera backend for mongodb with PE2017-2. I found some working examples with hiera v3 but I'd like to use hiera v5. So I've just wrote a kind of "hello world" for my 'lookup_key' backend function, in vain... Here is my hiera configuration: *"/etc/puppetlabs/puppet/hiera.yaml":* --- version: 5 hierarchy: - name: "common data (MongoDB version)" lookup_key: mongodb paths: - "node/%{trusted.certname}" - "common" options: dbname: "hiera" collection: "config" host: "localhost" Here is my custom lookup_key backend: *"/etc/puppetlabs/code/environments/production/modules/mongo/lib/puppet/functions/mongodb.rb" :* Puppet::Functions.create_function(:mongodb) do Puppet.warning("mongodb") dispatch :mongodb do param 'String[1]', :key param 'Hash[String[1],Any]', :options param 'Puppet::LookupContext', :context end def mongodb(key, options, context) Puppet.warning("Custom_lookup_key_mongodb_backend") context.not_found {} end end I used the 'lookup' function to solicit hiera and its custom backend but it does not appear to be called. Indeed, I have no "WARN" entries in 'puppetserver.log' despite 'Puppet.warning' calls... I do not understand what I missed. Thank you

Viewing all articles
Browse latest Browse all 257

Trending Articles