Thank you. I will take that and run with it. I appreciate the comments. On Thursday, August 24, 2017 at 9:27:31 AM UTC-5, Henrik Lindberg wrote: > > On 24/08/17 15:52, John Baird wrote: > > Henrik, I feel like this is becoming overly complicated and perhaps > > that is my fault for lack of explanation. > > > > I am simply trying to return the contents of a file that is stored in > > hiera... Perhaps my gist would make more sense ? > > > > https://gist.github.com/soudaburger/e253bdce191c731491581df0b0f99234 > > > I commented on your gist > https://gist.github.com/soudaburger/e253bdce191c731491581df0b0f99234 > > (for others) I wrote this on the gist: > > You need an additional function to transform a pathname with dots to one > where they are escaped. But skip that problem first and only test it > with a path that does not contain any dots > > Your backend function does not have the correct kind, and signature > it should not be a 'data_hash' kind - use a 'lookup_key' kind of backend > function (you must otherwise return the content of all files as one hash) > > read about how it should be written here: > https://docs.puppet.com/puppet/5.1/hiera_custom_lookup_key.html > > Your backend function should not have a 'scope_param' in the dispatcher > Use Puppet::Filesystem.read(path) to read the content of the file > referenced by 'path' > > The backend function receives a path in the options hash - that path is > guaranteed to exist - all non existing paths are simply skipped by hiera > (see the linked docs how it works). Thus, you do not need to use any of > the find file, etc. You can use relative paths in the hiera.yaml config > and hiera will figure it out (see the docs). > > - henrik > > -- > > Visit my Blog "Puppet on the Edge" > http://puppet-on-the-edge.blogspot.se/ > >
-- 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/5024a1a9-ef0d-4c44-97d0-c3906fea1057%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
