Naming is straightforward, a define like:
apache::vhost { 'example.com': }
could have its params looked in this namespace:
apache::vhost::example.com::<parameter>
My poor understanding of Puppet code points me to:
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/resource.rb#L343
and makes me guess that such a change should not be too difficult.
I see many wonderful use cases for such a feature and no apparent cons.
What do you think?
I've opened a ticket about this:
https://tickets.puppetlabs.com/browse/PUP-2528
al
Hallo everybody,I've tried to look around in the group for past discussions about this topic but haven't found any.
If this has been already debated , please forgive me and point me to the right direction.
I wonder what do you thing about a feature request to have data bindings also for defines' parameters.Naming is straightforward, a define like:
apache::vhost { 'example.com': }could have its params looked in this namespace:
apache::vhost::example.com::<parameter>
My poor understanding of Puppet code points me to:
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/resource.rb#L343
and makes me guess that such a change should not be too difficult.I see many wonderful use cases for such a feature and no apparent cons.
What do you think?
I've opened a ticket about this:
https://tickets.puppetlabs.com/browse/PUP-2528
al
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/6f9e8c23-53c2-420f-b7af-9b9fe7d5c1b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Thu, May 15, 2014 at 7:46 AM, Alessandro Franceschi <a...@lab42.it> wrote:
Hallo everybody,I've tried to look around in the group for past discussions about this topic but haven't found any.
If this has been already debated , please forgive me and point me to the right direction.
I tried to find the original ticket about data binding to see if there had been a previous discussion and came up with http://projects.puppetlabs.com/issues/11608 and http://projects.puppetlabs.com/issues/8235. There is also the commit that brought it in: https://github.com/puppetlabs/puppet/commit/3ac5b50ce66948d9488bd394c169022d55ecf0d1I wasn't able to figure out if there had been any discussion on this topic either.I wonder what do you thing about a feature request to have data bindings also for defines' parameters.Naming is straightforward, a define like:
apache::vhost { 'example.com': }could have its params looked in this namespace:
apache::vhost::example.com::<parameter>The problem with using that key for lookup is that it clashes with a class with the same name:class a::b($param) {} => a::b::paramcollides withdefine a($param) {}a { b: } => a::b::param
A better approach would possibly be to follow the resource reference syntax and have the key be A[b]::param or even A[b][param], which is the syntax in the language for puppet 4 to access resource parameter values (see https://tickets.puppetlabs.com/browse/PUP-488)
Hallo everybody,I've tried to look around in the group for past discussions about this topic but haven't found any.
If this has been already debated , please forgive me and point me to the right direction.
I wonder what do you thing about a feature request to have data bindings also for defines' parameters.
Naming is straightforward, a define like:
apache::vhost { 'example.com': }could have its params looked in this namespace:
apache::vhost::example.com::<parameter>My poor understanding of Puppet code points me to:
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/resource.rb#L343
and makes me guess that such a change should not be too difficult.
I see many wonderful use cases for such a feature and no apparent cons.
On Thursday, May 15, 2014 9:46:40 AM UTC-5, Alessandro Franceschi wrote:Hallo everybody,I've tried to look around in the group for past discussions about this topic but haven't found any.
If this has been already debated , please forgive me and point me to the right direction.
I wonder what do you thing about a feature request to have data bindings also for defines' parameters.
I'm skeptical about their value. We already have data bindings for classes, by which resource parameters can (indirectly) be injected, and I am inclined to think that classes are the right level of abstraction. On the other hand, we also have create_resources(), which already can give you resource-level data binding if you want to use it that way.
I do not favor drawing distinctions between defined resource types and native resource types. On that basis, I would argue for data binding either for all resource types or for none, and against data binding for only defined types.
I am concerned about the impact. It is already somewhat costly for Puppet to evaluate data bindings for class parameters, and adding bindings for resource parameters (even just for resources of defined types) will magnify that. Note that the cost scales with the aggregate number of defined parameters for all declared resources, independent whether any data are actually bound. In fact, the cases were no data are bound are the most costly, because hiera must then search the entire hierarchy.
Naming is straightforward, a define like:
apache::vhost { 'example.com': }could have its params looked in this namespace:
apache::vhost::example.com::<parameter>My poor understanding of Puppet code points me to:
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/resource.rb#L343
and makes me guess that such a change should not be too difficult.
I agree, the change probably would not be difficult to implement -- just costly. It might be interesting to have some data on what proportion of invocations of that method follow the "return nil" branch, avoiding a lookup. As a wild guess, I'll say at least 75% in a typical catalog compilation run (maybe we can start a pool :-)). Even if it were only 25%, though, that would translate into a 33% increase in the number of (expensive) lookups.
I see many wonderful use cases for such a feature and no apparent cons.
I see no particularly good use cases and several cons, but I'm prepared to be amazed by your vision. Would you care to elaborate?
content => template('apache/vhost.conf.erb'),
define apache::vhost($docroot,$template = 'apache/vhost.conf.erb',
content => template($template),
Regards, David
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscribe@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/5375A109.7020209%40dasz.at.
Regards, David
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/5375A109.7020209%40dasz.at.
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscribe@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/ll5q5d%24kqo%241%40ger.gmane.org.
On 2014-16-05 21:35, Alessandro Franceschi wrote:
> Andy,
> did this on a vagrant box with eyaml and file backends.
> The hierarchy has 7 levels.
>
> Debug: PROFILE [apply] 2.3.2 Called hiera: took 0.0156 seconds
>
If types on average have 10 parameters/properties, and you have 200 of
them, that means the overhead is something like 30 seconds for this
hierarchy. (Ballpark figure obviously) since it depends on where in the
hierarchy they are, and if they have values or not set in the manifests.
Out of curiosity, why not use the Puppet Resource Default mechanism and
only lookup in hiera what you actually need and set those values as
defaults? Is it too limited for what you want to do? If so how?
- henrik
On Thursday, May 15, 2014 9:55:05 PM UTC+2, John Bollinger wrote:
On Thursday, May 15, 2014 9:46:40 AM UTC-5, Alessandro Franceschi wrote:Hallo everybody,I've tried to look around in the group for past discussions about this topic but haven't found any.
If this has been already debated , please forgive me and point me to the right direction.
I wonder what do you thing about a feature request to have data bindings also for defines' parameters.
I'm skeptical about their value. We already have data bindings for classes, by which resource parameters can (indirectly) be injected, and I am inclined to think that classes are the right level of abstraction. On the other hand, we also have create_resources(), which already can give you resource-level data binding if you want to use it that way.
I do not favor drawing distinctions between defined resource types and native resource types. On that basis, I would argue for data binding either for all resource types or for none, and against data binding for only defined types.
I am concerned about the impact. It is already somewhat costly for Puppet to evaluate data bindings for class parameters, and adding bindings for resource parameters (even just for resources of defined types) will magnify that. Note that the cost scales with the aggregate number of defined parameters for all declared resources, independent whether any data are actually bound. In fact, the cases were no data are bound are the most costly, because hiera must then search the entire hierarchy.Yes, these are valid and convincing points.Anyway if we find data binding useful for classes and can bear the performance overhead, I suppose we can do the same for defined types.
I see many wonderful use cases for such a feature and no apparent cons.
I see no particularly good use cases and several cons, but I'm prepared to be amazed by your vision. Would you care to elaborate?Yes, why not. Let me digress a bit then. It could be useful to verify if the following idea seems cool only to me.First, a premise.
My point is that a reusable module should allow total freedom on how its configurations should be managed: with a file-based approach (source/template/ now epp_template...), with a setting-based approach, (augeas, file_line..) with concat or whatever. User should decide what's best for him, not the module author.
Also I think that a single parameter that expects an hash ( options_hash, config_file_options_hash, options, config... name it as you want) whose key values can be freely used in a [custom] template is better than dozens of parameters, totally unmaintainable, one for each possible configuration entry of an application (and for each one, as you pointed, a data binding lookup).
In this case the tp::install code could be as simple as this POC:define tp::install ($packages = { } ,$services = { } ,$files = { } ,$execs = { } ,$users = { } ,$configs = { } ,) {if $packages {create_resources('package', $packages)}if $services {create_resources('service', $services)}if $files {create_resources('file', $files)}if $execs {create_resources('exec', $execs)}if $users {create_resources('user', $users)}}
Anyway, however is organized the internal data, and the relevant code (instead of the create_resource we could use a lambda and cycle over the various hashes) having the possibility to use Hiera for the backend would be a good thing also because it would make easier for user to override the default module data with custom one.
I guess there are better ways to obtain the same (suggestions welcomed) rather than enabling data bindings for defined types and using data in modules (both features being not existing in Puppet core). For example with a custom function, but I have to figure out how to do it in the right way.
On Thursday, May 15, 2014 7:17:38 PM UTC-5, Alessandro Franceschi wrote:
On Thursday, May 15, 2014 9:55:05 PM UTC+2, John Bollinger wrote:
On Thursday, May 15, 2014 9:46:40 AM UTC-5, Alessandro Franceschi wrote:Hallo everybody,I've tried to look around in the group for past discussions about this topic but haven't found any.
If this has been already debated , please forgive me and point me to the right direction.
I wonder what do you thing about a feature request to have data bindings also for defines' parameters.
I'm skeptical about their value. We already have data bindings for classes, by which resource parameters can (indirectly) be injected, and I am inclined to think that classes are the right level of abstraction. On the other hand, we also have create_resources(), which already can give you resource-level data binding if you want to use it that way.
I do not favor drawing distinctions between defined resource types and native resource types. On that basis, I would argue for data binding either for all resource types or for none, and against data binding for only defined types.
I am concerned about the impact. It is already somewhat costly for Puppet to evaluate data bindings for class parameters, and adding bindings for resource parameters (even just for resources of defined types) will magnify that. Note that the cost scales with the aggregate number of defined parameters for all declared resources, independent whether any data are actually bound. In fact, the cases were no data are bound are the most costly, because hiera must then search the entire hierarchy.Yes, these are valid and convincing points.Anyway if we find data binding useful for classes and can bear the performance overhead, I suppose we can do the same for defined types.
In some cases we cannot bear the overhead even just for classes. People who tried to use hiera-gpg with Puppet 3 discovered that pretty quickly. Even if there were only a few encrypted data, the encrypted file gets decrypted for every class parameter that has no value specified in a higher-priority back end (which usually is most of them), making catalog compilation take forever.
We're not now in a comfort zone with respect to data binding cost -- we're near and sometimes over the edge of acceptable cost.
I see many wonderful use cases for such a feature and no apparent cons.
I see no particularly good use cases and several cons, but I'm prepared to be amazed by your vision. Would you care to elaborate?Yes, why not. Let me digress a bit then. It could be useful to verify if the following idea seems cool only to me.First, a premise.
[... omitted for brevity ...]
My point is that a reusable module should allow total freedom on how its configurations should be managed: with a file-based approach (source/template/ now epp_template...), with a setting-based approach, (augeas, file_line..) with concat or whatever. User should decide what's best for him, not the module author.
I accept the premise up to this point, with some reservations. In particular, I think it applies mainly to fairly low-level modules, such as those managing fairly narrow programs or services. Once you move into modules that compose those lower-level units, I don't think you can reliably stick to the premised approach any longer. On the other hand, it may be that such mid- or high-level modules are not well suited for reuse anyway.
if $config['packages'] {
create_resources('package', $config['packages'])
}
# etc...
}
You could even go further by bundling all the data for all tp-managed components into one higher-level hash, and looking it up just once, recording it in a variable of class tp for later access by the various defined types of the module.
Anyway, however is organized the internal data, and the relevant code (instead of the create_resource we could use a lambda and cycle over the various hashes) having the possibility to use Hiera for the backend would be a good thing also because it would make easier for user to override the default module data with custom one.
I agree that providing the data via Hiera is a good approach. I wouldn't recommend anything else.
I guess there are better ways to obtain the same (suggestions welcomed) rather than enabling data bindings for defined types and using data in modules (both features being not existing in Puppet core). For example with a custom function, but I have to figure out how to do it in the right way.
See above for one way.
John--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-dev/4lFhfChM9XM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/285608ae-a5f7-4091-b108-5a81309d3fe7%40googlegroups.com.
The hierarchy of such a tp module has to be module specific and should not depend on how data is managed in users’ hiera.yaml.Default data for the managed applications should be placed in the same tp module and be based on a module specific hierarchy, it would contain references to osfamily/operatingsystem/etc facts that can’t be forced into the users’ own local hierarchies (besides that fact that imho in a sane /etc/puppet/hiera.yaml file there should not be references to OS related facts) .
It seems to me that there are two reoccurring basic themes in this
thread of folks expressing either:
* eagerness to push more data into hiera
or
* sentiment that hiera is already a performance bottleneck
On Monday, May 19, 2014 11:42:57 AM UTC-5, Alessandro Franceschi wrote:The hierarchy of such a tp module has to be module specific and should not depend on how data is managed in users’ hiera.yaml.Default data for the managed applications should be placed in the same tp module and be based on a module specific hierarchy, it would contain references to osfamily/operatingsystem/etc facts that can’t be forced into the users’ own local hierarchies (besides that fact that imho in a sane /etc/puppet/hiera.yaml file there should not be references to OS related facts) .
Ok, but you're throwing a curve there. Your original suggestion / request had none of those constraints. Would those concerns be adequately addressed if R.I.'s data in modules were in the core product? Alternatively, would it be acceptable for the 'tp' module to depend on a module providing that feature? Or to provide that or something equivalent itself?
> Thanks anyway for the attempt, hopefully now is clearer why I can’t do this with existing functionalities.
Your requirements are clearer, yes. What's not quite clear yet is whether you want to avoid your data binding falling back to general data when resource parameters are not found in module-specific data. If you do want to avoid that then I think you're right that existing functionalities won't do what you want, but then I'm certain that you were wrong earlier about what you want being achievable by a simple modification.
On the other hand, I think you could put a custom function into module 'tp' that would read data from (only) a module-specific data source, along lines similar to hiera. If you used such a function instead of hiera(), then could a solution along the lines I described work for you?
John
On Tuesday, May 20, 2014 6:25:10 PM UTC+2, John Bollinger wrote:
If you have any suggestion on how to use directly Hiera that would be welcomed, as usual.> Thanks anyway for the attempt, hopefully now is clearer why I can’t do this with existing functionalities.
Your requirements are clearer, yes. What's not quite clear yet is whether you want to avoid your data binding falling back to general data when resource parameters are not found in module-specific data. If you do want to avoid that then I think you're right that existing functionalities won't do what you want, but then I'm certain that you were wrong earlier about what you want being achievable by a simple modification.
Well, if data binding for defines is not a possibile approach, the module will have its internal default values for parameters and accept (of course) users' overrides.
I still have to figure out how to merge user provided data with internal default data ( I think it make sense to expose a parameter that let the user define the merge behaviour)
On the other hand, I think you could put a custom function into module 'tp' that would read data from (only) a module-specific data source, along lines similar to hiera. If you used such a function instead of hiera(), then could a solution along the lines I described work for you?
Yep, the tp_lookup function mentioned earlier is expected to do what I'd have preferred to do via Hiera data bindings (on defined params) + module in data.
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/579481e0-f2bd-4162-b846-6602824c3c4e%40googlegroups.com.To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+...@googlegroups.com.