>
> Henrik,

I have something that appears to be at least "attempting" to find the 
proper files.  The issue I am currently running into is that the "key" or 
file that I am looking for is being "chopped" at the first ".", which in 
this case is actually in a folder name, not the file extension.  Do you 
know how to avoid that?

*# File Backend for Hiera*
*Puppet::Functions.create_function(:'file_backend') do*

*  dispatch :file_backend do*
*    param "String", :key*
*    param "Hash", :options*
*    param "Puppet::LookupContext", :context*
*  end*

*  argument_mismatch :missing_path do*
*    param 'Hash', :options*
*    param 'Puppet::LookupContext', :context*
*  end*

*  def file_backend(key, options, context)*
*    hieradir   = context.interpolate(options['hieradir'])*
*    searchroot = context.interpolate(options['searchroot'])*
*    searchpath = hieradir + searchroot*
*    if (File.exists?("#{searchpath}/#{key}"))*
*      data = File.read("#{searchpath}/#{key}")*
*    else*
*      context.explain() { "SearchPath: #{searchpath}, Key: #{key}"}*
*      context.not_found()*
*    end*
*  end*

*  def missing_path(options, context)*
*    "one of 'path', 'paths', 'glob', 'globs', or 'mapped_paths' must be 
declared in hiera.yaml when using this file_backend function"*
*  end*
*end*

When looking up '*/etc/dd-agent/checks.d/filename.py'* I receive a `*Function 
lookup() did not find a value for the name 
'/etc/dd-agent/checks.d/filename.py*`.

The debugging from the puppet lookup outputs *KEY: /etc/dd-agent/checks *which 
does not contain the rest of the filename or path.

Thoughts ?

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/7a86b718-434c-42ff-ad50-649f276c75ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to