Jira (PUP-4531) create_resources() should deep merge the default parameters
Title: Message Title Henrik Lindberg commented on PUP-4531 Re: create_resources() should deep merge the default parameters Closing this as a won't do (as per earlier comment, and 4.x has now been out for quite some time). 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-4531) create_resources() should deep merge the default parameters
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-4531 create_resources() should deep merge the default parameters Change By: Henrik Lindberg Team: Puppet Developer Support 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-4531) create_resources() should deep merge the default parameters
Title: Message Title Davide Ferrari commented on PUP-4531 Re: create_resources() should deep merge the default parameters Well, there is indeed an undocumented deep_merge() in stdlib (I use it quite a lot, hoping that it won't just disappear one day), and in fact I'm using it to work around the current behaviour, but it makes code more complex in my opinion. Anyway it seems to me that you comment feels like it's not a bug, it's a feature, right? Add Comment This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d) -- 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 http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4531) create_resources() should deep merge the default parameters
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-4531 create_resources() should deep merge the default parameters Change By: Henrik Lindberg Issue Type: Bug NewFeature Add Comment This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d) -- 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 http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4531) create_resources() should deep merge the default parameters
Title: Message Title Henrik Lindberg commented on PUP-4531 Re: create_resources() should deep merge the default parameters Yes, this ticket is a request for a new feature. I am also saying that there needs to be functions that have simple straight forward behavior to build other functions on. Say that we were to change the create_resources to always do deep merge, then there is no way to stop that from happening. This means adding more parameters to control if merge should take place or not. Then people will need control over the merge (which adds several additional options). This is what I am referring to as swiss army knife - a function that includes the functionality for everything you need. From puppet 4.1.0 you can write functions in the puppet language and it is thus very simple to create your own mymodule::create_resources function that performs merges and calls the create_resources function in puppet core. If you want to do this before then, you need to write that function in ruby. If you are using future parser or are using puppet 4.0.0 you can use the 4.x function API to create a name spaces function (so you can use the same name 'create_resources' and not worry about it clashing with something else). Add Comment This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d) -- 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 http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4531) create_resources() should deep merge the default parameters
Title: Message Title Henrik Lindberg commented on PUP-4531 Re: create_resources() should deep merge the default parameters We have extended the syntax for resources in the 3.x future parser that allows a lot more control over default values as well as the ability to set parameters from a hash. This was done to allow data transfomrations / merges etc. to be done prior to creating a resource. We think this is a better approach that turning every function into a swiss army knife of functionality. If you start doing merges and deep merges - how should they be done, what if it is an array inside, what if certain values should be kept or override, etc. (Sort of all the things the deep-merge gem does that is used with hiera and puppet lookup). I would rather add a general purpose hash deep merge function that adding deep merge functionality to the create_resources (if there is no such function already in stdlib). That would also be backwards compatible since it is up to users to call such functions and present the data the way the create_resources function (currently) expects them. Add Comment This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d) -- 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 http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4531) create_resources() should deep merge the default parameters
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-4531 create_resources() should deep merge the default parameters Change By: Henrik Lindberg Scrum Team: Language Add Comment This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d) -- 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 http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4531) create_resources() should deep merge the default parameters
Title: Message Title Davide Ferrari created an issue Puppet / PUP-4531 create_resources() should deep merge the default parameters Issue Type: Bug Assignee: Unassigned Created: 2015/05/06 8:27 AM Priority: Normal Reporter: Davide Ferrari If you instance a resource with create_resources() and that resource takes a hash (call it $options) as a parameter, you should be able to define a default value for the keys inside the $options parameter. define my_resource($options = {}) { notify(param1 is ${options['param1'}) # undef, it should be 'from defaults' notify(param2 is ${options['param2'})
Jira (PUP-4531) create_resources() should deep merge the default parameters
Title: Message Title Davide Ferrari updated an issue Puppet / PUP-4531 create_resources() should deep merge the default parameters Change By: Davide Ferrari Ifyouinstancearesourcewithcreate_resources()andthatresourcetakesahash(callit$options)asaparameter,youshouldbeabletodefineadefaultvalueforthekeysinsidethe$optionsparameter.{code}definemy_resource($options={}){notify ( { param1is${options['param1'} ) :} #undef,itshouldbe'fromdefaults'notify ( { param2is${options['param2'} ) :} #'param2isoverwritten'}$default_resource_params={'options'={'param1'='fromdefaults','param2'='fromdefaults'}}$my_resources={'foo'={'options'={'param2'='overwritten'}}}create_resources('my_resource',$my_resouces,$default_resource_params){code} Add Comment This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d) -- 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 http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4531) create_resources() should deep merge the default parameters
Title: Message Title Davide Ferrari updated an issue Puppet / PUP-4531 create_resources() should deep merge the default parameters Change By: Davide Ferrari Ifyouinstancearesourcewithcreate_resources()andthatresourcetakesahash(callit$options)asaparameter,youshouldbeabletodefineadefaultvalueforthekeysinsidethe$optionsparameter.{code}definemy_resource($options={}){notify{param1is${options['param1' } ] :}#undef,itshouldbe'fromdefaults'notify{param2is${options['param2' } ] :}#'param2isoverwritten'}$default_resource_params={'options'={'param1'='fromdefaults','param2'='fromdefaults'}}$my_resources={'foo'={'options'={'param2'='overwritten'}}}create_resources('my_resource',$my_resouces,$default_resource_params){code} Add Comment This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d) -- 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 http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4531) create_resources() should deep merge the default parameters
Title: Message Title Davide Ferrari updated an issue Puppet / PUP-4531 create_resources() should deep merge the default parameters Change By: Davide Ferrari Ifyouinstancearesourcewithcreate_resources()andthatresourcetakesahash(callit$options)asaparameter,youshouldbeabletodefineadefaultvalueforthekeysinsidethe$optionsparameter.{code}definemy_resource($options={}){notify{param1is${options['param1'] } :}#undef,itshouldbe'fromdefaults'notify{param2is${options['param2'] } :}#'param2isoverwritten'}$default_resource_params={'options'={'param1'='fromdefaults','param2'='fromdefaults'}}$my_resources={'foo'={'options'={'param2'='overwritten'}}}create_resources('my_resource',$my_resouces,$default_resource_params){code} Add Comment This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d) -- 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 http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4531) create_resources() should deep merge the default parameters
Title: Message Title Davide Ferrari updated an issue Puppet / PUP-4531 create_resources() should deep merge the default parameters Change By: Davide Ferrari Ifyouinstancearesourcewithcreate_resources()andthatresourcetakesahash(callit$options)asaparameter,youshouldbeabletodefineadefaultvalueforthekeysinsidethe$optionsparameter.{code}definemy_resource($options={}){notify{param1is${options['param1']}:}#undef,itshouldbe'fromdefaults'notify{param2is${options['param2']}:}#'param2isoverwritten'}$default_resource_params={'options'={'param1'='fromdefaults','param2'='fromdefaults'}}$my_resources={'foo'={'options'={'param2'='overwritten'}}}create_resources('my_resource',$ my_resouces my_resources ,$default_resource_params){code} Add Comment This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d) -- 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 http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4531) create_resources() should deep merge the default parameters
Title: Message Title Davide Ferrari updated an issue Puppet / PUP-4531 create_resources() should deep merge the default parameters Change By: Davide Ferrari Ifyouinstancearesourcewithcreate_resources()andthatresourcetakesahash(callit$options)asaparameter,youshouldbeabletodefineadefaultvalueforthekeysinsidethe$optionsparameter.{code}definemy_resource($options={}){notify{param1is${options['param1']}:}# undef empty , it shouldbe'fromdefaults'notify{param2is${options['param2']}:}#'param2isoverwritten'}$default_resource_params={'options'={'param1'='fromdefaults','param2'='fromdefaults'}}$my_resources={'foo'={'options'={'param2'='overwritten'}}}create_resources('my_resource',$my_resources,$default_resource_params){code} Output: {code}Notice:Compiledcatalogfordarkshadow.localinenvironmentproductionin0.03secondsNotice:param1isNotice:/Stage[main]/Main/My_resource[foo]/Notify[param1is]/message:defined'message'as'param1is'Notice:param2isoverwrittenNotice:/Stage[main]/Main/My_resource[foo]/Notify[param2isoverwritten]/message:defined'message'as'param2isoverwritten'{code} Add Comment This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d) -- 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 http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.
Jira (PUP-4531) create_resources() should deep merge the default parameters
Title: Message Title Davide Ferrari updated an issue Puppet / PUP-4531 create_resources() should deep merge the default parameters Change By: Davide Ferrari Affects Version/s: PUP3.7.5 Add Comment This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d) -- 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 http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/d/optout.