Jira (PUP-10259) Hiera cannot interpolate non-string values
Title: Message Title David McTavish updated an issue Puppet / PUP-10259 Hiera cannot interpolate non-string values Change By: David McTavish Priority: Normal Low Add Comment This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.244421.1522942982000.21284.1638821460048%40Atlassian.JIRA.
Jira (PUP-10259) Hiera cannot interpolate non-string values
Title: Message Title David McTavish updated an issue Puppet / PUP-10259 Hiera cannot interpolate non-string values Change By: David McTavish Labels: final_triage Add Comment This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.244421.1522942982000.21285.1638821460069%40Atlassian.JIRA.
Jira (PUP-10259) Hiera cannot interpolate non-string values
Title: Message Title Molly Waggett updated an issue Puppet / PUP-10259 Hiera cannot interpolate non-string values Change By: Molly Waggett Team: Froyo Phoenix Add Comment This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.244421.1522942982000.21459.164740032%40Atlassian.JIRA.
Jira (PUP-10259) Hiera cannot interpolate non-string values
Title: Message Title Molly Waggett updated an issue Puppet / PUP-10259 Hiera cannot interpolate non-string values Change By: Molly Waggett Labels: final_triage Add Comment This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.244421.1522942982000.21463.164800256%40Atlassian.JIRA.
Jira (PUP-10259) Hiera cannot interpolate non-string values
Title: Message Title Josh Cooper updated an issue Puppet / PUP-10259 Hiera cannot interpolate non-string values Change By: Josh Cooper Component/s: Hiera & Lookup Add Comment This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.244421.1522942982000.18406.1651035120068%40Atlassian.JIRA.
Jira (PUP-10259) Hiera cannot interpolate non-string values
Title: Message Title Thomas Hallgren moved an issue Puppet / PUP-10259 Hiera cannot interpolate non-string values Change By: Thomas Hallgren Key: HI PUP - 599 10259 Project: Hiera Puppet Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.244421.1522942982000.3177.1580237340575%40Atlassian.JIRA.
Jira (PUP-10259) Hiera cannot interpolate non-string values
Title: Message Title Trevor Vaughan commented on PUP-10259 Re: Hiera cannot interpolate non-string values Thomas Hallgren Seems reasonable to me. Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.244421.1522942982000.3211.1580237880452%40Atlassian.JIRA.
Jira (PUP-10259) Hiera cannot interpolate non-string values
Title: Message Title Henrik Lindberg commented on PUP-10259 Re: Hiera cannot interpolate non-string values To be honest I am so sick and tired of the horrible hiera interpolation syntax - here with interpolation functions that makes the result not be an interpolation - I think it is just bizarre ... I never liked this because playing tricks with interpolation functions is pretty much the only thing that can be done and retaining backwards data compatibility. Using lookup_options is however different in that there we decide the meaning/encoding of whatever is described there. So, we could "type" the meaning of a key - for example "get the value using getvar()" (which the example above from thomas means). Now, if we instead generalize that to state that the looked up value is given to a mentioned function before being returned - the lookup would first produce 'facts.selinux.enabled', and the lookup_option would say that it should be passed through getvar(), and thus yielding the result of getvar('facts.selinux.enabled'). This mechanism can then be used such that if the called function accepts a LookupContext then it would be given it when function is called - the called function can then also perform a "not-found" as an outcome, and it would be able to (somehow) also keep track of that context for recursion. (This is something I did in a Puppet language hiera 5 backend function - where you would simply write "getvar('facts.selinux.enabled') as the value for the key. The code for that ppyaml backend function is here: https://github.com/hlindberg/tahu/blob/master/lib/puppet/functions/tahu/ppyaml_key.rb in case someone is interested. Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Jira (PUP-10259) Hiera cannot interpolate non-string values
Title: Message Title Thomas Hallgren commented on PUP-10259 Re: Hiera cannot interpolate non-string values Using a lookup_option to appoint a lookup_key style function would certainly work, and would be a nice feature to have but having a strict interpolation that propagates "not found" would be really nice too. It is probably easier to learn for the user since it relies on an already established pattern. Compare these: lookup_options: docker::selinux_enabled: delegate_to: strict_scope docker::selinux_enabled: "%{strict('facts.selinux.enabled')}" and consider that the familiar pattern that we are trying to fix without making a breaking change, is this: docker::selinux_enabled: "%{'facts.selinux.enabled'}" Adding a `strict` function to the current set of interpolation functions is also less effort for us to implement. The current logic is fully recursion protected. We must improve that protection if we decide to implement an ability to call arbitrary function.
Jira (PUP-10259) Hiera cannot interpolate non-string values
Title: Message Title Henrik Lindberg commented on PUP-10259 Re: Hiera cannot interpolate non-string values I don't mind adding strict_alias being added as an interpolation function. Just saying that I would like to have a solution at some point that is more general. Small comment on your comment: What I intended was that the looked up value to be given to a function, not that the value would be given as `arguments` in the lookup_options (while that would naturally be a way to add additional arguments). Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.244421.1522942982000.4254.1580294640236%40Atlassian.JIRA.
Jira (PUP-10259) Hiera cannot interpolate non-string values
Title: Message Title Thomas Hallgren commented on PUP-10259 Re: Hiera cannot interpolate non-string values In this case (looking up an alias), the argument is needed to declare what alias to look up. How would that be declared otherwise. Just passing the original key doesn't help much unless the actual function knows about aliases. But if so, where does it get that info? Add Comment This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93) -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-bugs+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-bugs/JIRA.244421.1522942982000.4290.1580295540903%40Atlassian.JIRA.
Jira (PUP-10259) Hiera cannot interpolate non-string values
Title: Message Title Henrik Lindberg commented on PUP-10259 Re: Hiera cannot interpolate non-string values I was thinking that you bind the value facts.selinux.enabled to docker::selinux_enabled key. Then, you make that value special using lookup_options - in a way defining the syntax & semantics of what is there. One way (as I suggested) is to simply take the value and give it to a function (that defines the meaning of the value). Then, you could (if you wanted to) put a string of Puppet code as the value of the lookup, and say the function is puppet_eval if you wanted to - i.e. completely open ended extendable by functions. So, specifically for aliases I imagine the function would be something like `strict_alias` and it would be called with the looked up value, and the function would then use the context it gets to perform a lookup using the value it got as the key. You can do really powerful things with a general purpose "delegate". Another option here (not using lookup_options) would be to add the delegate support as an interpolation function (even though (as stated earlier) have a dislike for "non interpolation features expressed as an interpolation"). This would require some more expressiveness in how you can invoke interpolation functions, for example giving multiple arguments to it, support for different kinds of literal data, etc. etc. - and that starts to snowball... It could be something like: some::key: "%{`puppet: ...puppetcode here `}" some::key: "%{`myfunc: ...whatever myfunc understands`}" But I have not thought much about that idea as opposed to having the `puppet` or `myfunc` part be in lookup_options and then just putting whatever the argument should be into the value. One thing is that you could probably combine so that the key looks up a hash (maybe even with merge) and then get that as input to your function. ... Maybe it is not so much a `delegate` as a `post_process` since it would be acting on the looked up result... Anyhow, there are probably dragons to watch out for, and meanwhile, I have to objection against adding a strict_ailas interpolation function. (I am just brainstorming about what we could possibly do for the future to allow anyone to innovate in this area without requiring further additions to puppet/hiera itself and without completely changing the hiera data syntax. One more thought... the lookup_option could be a kind of delegation, that if turned on it expects the lookup result to be a hash, and it expects a key in this hash to be the function to call with that hash as argument - then you would see something like this in data (using a puppet_eval as an example):