Jira (PUP-7447) Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack)
Title: Message Title Henrik Lindberg commented on PUP-7447 Re: Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack) I am going to close this as Won't Do. Thomas posted an outline for how to do this with a custom backend. I would like to add that an implementation of the backend should either reject all non namespaces keys, or prefix them with '::' before looking up in scope as there is otherwise a risk for getting local variables. (There is no need to prefix already namespaced keys). Also when implementing the backend, a lookup of a variable can fail when strict variables is on, the implementation must catch that throw and call not_found on the context for that. 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 post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-7447) Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack)
Title: Message Title Moses Mendoza updated an issue Puppet / PUP-7447 Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack) Change By: Moses Mendoza Team: Agent Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- 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 post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-7447) Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack)
Title: Message Title Lindsey Smith assigned an issue to Eric Sorenson Puppet / PUP-7447 Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack) Change By: Lindsey Smith Assignee: Lindsey Smith Eric Sorenson Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- 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 post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-7447) Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack)
Title: Message Title Moses Mendoza assigned an issue to Lindsey Smith Puppet / PUP-7447 Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack) Change By: Moses Mendoza Assignee: Lindsey Smith Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- 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 post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-7447) Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack)
Title: Message Title Moses Mendoza updated an issue Puppet / PUP-7447 Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack) Change By: Moses Mendoza Labels: needs_decision triaged Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- 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 post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-7447) Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack)
Title: Message Title Moses Mendoza updated an issue Puppet / PUP-7447 Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack) Change By: Moses Mendoza Labels: triaged Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- 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 post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-7447) Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack)
Title: Message Title Henrik Lindberg commented on PUP-7447 Re: Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack) I would rather see that the values / bindings from ENC are mixed into the data hierarchy than wiring the compiler's scopes into the data hierarchy. I understand there are situations where you really want the "effective value of what class foo's parameter bar ended up being set to, irrespective of how it was set" and that you would like that value to be produced by a call to lookup. This because knowing the value that an APL results in for a class parameter is not enough, since the value could have been explicitly set in code, or it could, if there was no binding, and nothing was given be the result of the default value _expression_. There once was such a hiera backend; it allowed lookup in the catalog being produced. This backend was removed because of the many problems/confusing cases users ran into. The function as shown by Thomas above would essentially provide the same feature. Not sure I would want that to be part of Puppet and that we would want to promote the use of that pattern. At the same time the current state of ENC, roles/profiles, and use of APL is far from perfect - and I would really like to see that problem solved. Ping Eric Sorenson and Lindsey Smith. Add Comment This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe) -- 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 post to this group, send email to puppet-bugs@googlegroups.com. Visit this group at https://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-7447) Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack)
Title: Message Title Trevor Vaughan commented on PUP-7447 Re: Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack) Thomas Hallgren Thanks for the response. You are correct that we want Global on down, which is what you would expect if you were referencing something as a class parameter and is the way most users end up thinking about variable lookups in Puppet since the advent of automatic parameter lookups. It's rare that I see direct calls to lookup in code and, when I do, I can tell that they expect things to work with PE out of the box (but it won't). Unfortunately, that will require a modification to the Hiera configuration for all of our users which is what we were trying to avoid by requesting that this capability be added to lookup as a switch. If there's no hope of this happening, we'll post the Hiera configuration and I would suggest that you update the lookup documentation to include a working example and/or a 'supported' Hiera backend module for doing this so that users can have assurance that it will continue to function and you can test it against upcoming changes in Puppet. Interestingly, we ran into this just the other day which I completely understand is order dependent and we need to watch out for this, but the scenario was that we had a defined type that needed a value from the top level class. For this example, we'll call the foo::def and foo::var. So, foo::def::bar needed to default to the value of foo::var and there are a couple of ways to do this. The first, is to use the pick function but this is annoying because I can't just use pick, I have to use pick with getvar so that the compiler doesn't complain at me. Also, this gets a bit confusing for users because pick + getvar is not very widely used. And, unfortunately, in this case it doesn't actually matter if the top scope parameter isn't defined. We just need a consistent method for changing it globally that works with class resource declarations. Now, lookup can almost do this, but unfortunately, as implemented currently, it can't because it doesn't hit gobal scope. But, it would be great to use lookup since, at this point, pretty much everyone understands what lookup does and they would not need to update their Hiera configuration and add a new backend if it just had the option to keep looking. Anyway, I have a feeling that I'm not going to see this so we'll move towards the Hiera backend. I do hope that we see a supported Hiera backend that we can use to do this though! Add Comment
Jira (PUP-7447) Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack)
Title: Message Title Thomas Hallgren commented on PUP-7447 Re: Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack) I don't understand this hierachy: Hiera -> Class Declarations (Profiles) -> normal lookup() stuff Hiera IS the normal lookup stuff. They are not two separate things. Perhaps you mean: Global layer -> Class Declarations (Profiles) -> Environment layer -> Module layer ? If so, then it should be easy enough to achieve by just adding a lookup_key function, either at the end of the global hierarchy or at the start of the environment hierarchy, that essentially performs the same task as the simplib::lookup but calls context#not_found unless it finds the global value. By doing that, you gain the following advantages: You get the desired hierarchy. You get explain support. Values can be merged. Instead of calling closure_scope, I'd recommend injecting it into a parameter. Like this: Puppet::Functions.create_function(:'my::scope_lookup', Puppet::Functions::InternalFunction) do dispatch :scope_lookup do scope_param param 'String[1]', :key param 'Hash[String[1],Any]', :options
Jira (PUP-7447) Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack)
Title: Message Title Trevor Vaughan created an issue Puppet / PUP-7447 Need prescriptive method for combining 'lookup' with ENCs and the Roles/Profiles pattern (aka, lookup should look up the entire stack) Issue Type: Improvement Affects Versions: PUP 4.10.0, PUP 4.7.0 Assignee: Unassigned Created: 2017/04/12 2:44 PM Environment: All Priority: Normal Reporter: Trevor Vaughan So, lookup is great, I like it, but I was dismayed to find that I had to write overly complex code to make parameter lookups work when I wanted to use the lookup function as a parameter default. We ended up implementing simplib::lookup over at https://github.com/simp/pupmod-simp-simplib/blob/master/lib/puppet/functions/simplib/lookup.rb which, let's face is, is a horrible way to get around this issue. So, I would like to propose that 'lookup', start at the top of the traditional Puppet Hierarchy until such time that it is killed off. This would mean: Hiera -> Class Declarations (Profiles) -> normal lookup() stuff If there is a better way to do this, I would very much like to know it. Unfortunately, I couldn't find one.