Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-09-22 Thread John Baird
Justin, I would love to see what you have done. Would you be willing to send me what you've written. It's possible I could extend what you've done to resolve my huge lingering issue, which is being able to some sort of file-based lookup WITH file extensions (as default lookup behavior chops a

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-09-16 Thread Justin DynamicD
I had a similar but "not quite the same" challenge. Basically I just added a custom ruby function to let you parse the data you're looking for. So in addition to lookup (), I now have things like consul_servicenames() which dumps all services presented by a host in an array format (handy for i

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-09-15 Thread Henrik Lindberg
On 15/09/17 19:18, John Baird wrote: Right, and that's exactly my concern with NOT being able to do exactly that. Scenarios 1.  I wish to lookup a URI that is to be configured for a module.  The module name here is obviously not important, but let's call it "mymodule".  In the manifest, I wish

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-09-15 Thread John Baird
Right, and that's exactly my concern with NOT being able to do exactly that. Scenarios 1. I wish to lookup a URI that is to be configured for a module. The module name here is obviously not important, but let's call it "mymodule". In the manifest, I wish to lookup ssh keys being served up by

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-09-15 Thread Henrik Lindberg
On 15/09/17 16:46, John Baird wrote: I just realized, while doing some other hiera work with a custom HTTP backend, that this won't work.  It's the same problem I have with the way scoping works for the HTTP backend.  If I don't specify the lookup() key in the manifest with a scope, then puppet

[Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-09-15 Thread John Baird
I just realized, while doing some other hiera work with a custom HTTP backend, that this won't work. It's the same problem I have with the way scoping works for the HTTP backend. If I don't specify the lookup() key in the manifest with a scope, then puppet ONLY uses GLOBAL and ENVIRONMENT sco

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-09-03 Thread Henrik Lindberg
On 02/09/17 13:02, John Baird wrote: Henrik, I really appreciate your patience here, but I feel like there is something obvious that I am either not grasping or isn't spelled out in the documentation. Let's say I make a function called `lookup_file` which will do the File.Read in whatever m

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-09-02 Thread John Baird
Henrik, I really appreciate your patience here, but I feel like there is something obvious that I am either not grasping or isn't spelled out in the documentation. Let's say I make a function called `lookup_file` which will do the File.Read in whatever manner I need. I can call that from my mani

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-09-02 Thread Henrik Lindberg
On 01/09/17 01:32, John Baird wrote: Henrik, I think the disconnect is coming from the fact that the documentation only goes so far.  In that, I mean, what should my lookup be from my manifest? Should my manifest be: $somefile = lookup('/etc/example.txt') and then specify the file_backend in

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-08-31 Thread John Baird
Henrik, I think the disconnect is coming from the fact that the documentation only goes so far. In that, I mean, what should my lookup be from my manifest? Should my manifest be: $somefile = lookup('/etc/example.txt') and then specify the file_backend in my hiera.yaml? Or should my manifest be

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-08-28 Thread Henrik Lindberg
On 28/08/17 00:45, John Baird wrote: 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

[Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-08-27 Thread John Baird
> > 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 con

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-08-24 Thread John Baird
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 la

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-08-24 Thread Henrik Lindberg
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.git

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-08-24 Thread John Baird
> > 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/e253bdce191c731491581

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-08-24 Thread Henrik Lindberg
On 24/08/17 04:27, John Baird wrote: Henrik, Thanks for the feedback, while I wish there was a "better/native" way, I have accepted that I need to write my own function.  I would like to be able to use a similar syntax as "lookup()" and simply specify a filepath and have the contents returned

[Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-08-23 Thread John Baird
Henrik, Thanks for the feedback, while I wish there was a "better/native" way, I have accepted that I need to write my own function. I would like to be able to use a similar syntax as "lookup()" and simply specify a filepath and have the contents returned as the content of the file being creat

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-08-23 Thread Henrik Lindberg
On 23/08/17 03:28, John Baird wrote: Henrik, Thanks for the feedback.  My concern stems, really, from being able to use this with Puppet.  I would think that I should be able to specify a filename and/or filepath that contain a "." without having to escape those myself.  The backend should ha

[Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-08-22 Thread John Baird
Henrik, Thanks for the feedback. My concern stems, really, from being able to use this with Puppet. I would think that I should be able to specify a filename and/or filepath that contain a "." without having to escape those myself. The backend should handle that, in my opinion. You can imag

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-08-22 Thread Henrik Lindberg
On 22/08/17 18:30, John Baird wrote: 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

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-08-22 Thread John Baird
> > 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.

Re: [Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-08-22 Thread Henrik Lindberg
On 22/08/17 16:57, John Baird wrote: Henrik, Whether the existing YAML/JSON/HOCON backend is referenced, everything is using the context of `path` to do the lookups.  The issues with this in regards to a file backend, is I am unsure as to how to access the value or file being looked up.  The

[Puppet Users] Re: Hiera 5 + Puppet 5 File Backend

2017-08-22 Thread John Baird
Henrik, Whether the existing YAML/JSON/HOCON backend is referenced, everything is using the context of `path` to do the lookups. The issues with this in regards to a file backend, is I am unsure as to how to access the value or file being looked up. The `path` for the other backends is static