Jira (PUP-6422) ensure_resource not longer working with undef parameters
Title: Message Title David Schmitt commented on PUP-6422 Re: ensure_resource not longer working with undef parameters The error is caused by this commit: 317727dafff612cbdb489c98ed286c53c25f290d is the first bad commit commit 317727dafff612cbdb489c98ed286c53c25f290d Author: Henrik LindbergDate: Sat Jun 4 00:43:14 2016 +0200 ( PUP-6385 ) Make create_resources filter out undef relationships This adds logic that filters out all parameters that are undef from the instruction built by create_resources. This is done to prevent validation of relationships to flag relationships to undef as an error. This is done for all parameters since an undef parameter means that the default value should be used. (The language evaluator does the same thing). Of course this specific surfacing of the API change can be worked around in stdlib. Add Comment This message was sent by Atlassian JIRA (v6.4.13#64028-sha1:b7939e9) -- 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-6422) ensure_resource not longer working with undef parameters
Title: Message Title Henrik Lindberg commented on PUP-6422 Re: ensure_resource not longer working with undef parameters The change to "modules team" is because they deal with stdlib, and the definition of what the functions are supposed to do. Do this: ret = false if resource = findresource(reference.to_s) matches = params.collect do |key, value| resource[key] == value.eql?(:undef) ? nil : value # eql? avoids bugs caused by monkeypatching in puppet end ret = params.empty? || !matches.include?(false) end ret The best is to make a PR against stdlib and ping David Schmitt (which I just did)
Jira (PUP-6422) ensure_resource not longer working with undef parameters
Title: Message Title Reinhard Vicinus commented on PUP-6422 Re: ensure_resource not longer working with undef parameters Sorry to bother but is any information still needed? Also does the change of the scrum team to modules mean, that stdlib module needs to be updated? If so the defined_with_params function works this way: ret = false if resource = findresource(reference.to_s) matches = params.collect do |key, value| resource[key] == value end ret = params.empty? || !matches.include?(false) end ret The problem is, that :undef is compared to nil. So I changed defined_with_params to work again as expected this way:
Jira (PUP-6422) ensure_resource not longer working with undef parameters
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-6422 ensure_resource not longer working with undef parameters Change By: Henrik Lindberg Sprint: Language Triage Add Comment This message was sent by Atlassian JIRA (v6.4.13#64028-sha1:b7939e9) -- 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-6422) ensure_resource not longer working with undef parameters
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-6422 ensure_resource not longer working with undef parameters Change By: Henrik Lindberg Scrum Team: Language Modules Add Comment This message was sent by Atlassian JIRA (v6.4.13#64028-sha1:b7939e9) -- 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-6422) ensure_resource not longer working with undef parameters
Title: Message Title Reinhard Vicinus commented on PUP-6422 Re: ensure_resource not longer working with undef parameters The code in questions extends the file resource and has the same parameters as the file resource with default value undef which are passed to the file resource. To work perfectly, my code would need that puppet could magically determine the intention of a value undef. I know that this is not possible. At the moment with puppet 4.5.0 and older versions, default values set with File { owner => 'root' } do not work, so the parameter is explicitly set to undef with puppet 4.5.0 and older versions. That is the expected behavior which seems to have changed between puppet 4.5.0 and 4.5.2. For a deeper understanding for what I do look at the create parent directories example. Add Comment This message was sent by Atlassian JIRA (v6.4.13#64028-sha1:b7939e9) -- 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-6422) ensure_resource not longer working with undef parameters
Title: Message Title Henrik Lindberg commented on PUP-6422 Re: ensure_resource not longer working with undef parameters I am asking what you expect your code to do? It is clear that the functions are unclear on how it is supposed to work, so you must be thinking that it is working a particular way. If you want it to set the value to undef then you probably now get what you want and that it did not work earlier. (You are asking puppet to ensure that the file in question has an explicitly undefined owner). You will probably get what you want by removing the undef entries in the hash. There is no way of specifying that you want a resource to have a value that is default from the perspective it was created in - the default value in the context where you are performing the call to ensure/create resources may resolve to a different default value. It must also be possible to ask for an ensured resource that explicitly has an undef attribute. Add Comment This message was sent by Atlassian JIRA (v6.4.13#64028-sha1:b7939e9) -- 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-6422) ensure_resource not longer working with undef parameters
Title: Message Title Reinhard Vicinus commented on PUP-6422 Re: ensure_resource not longer working with undef parameters Internally ensure_resource works like this: if !function_defined_with_params(["#{type}[#{item}]", params]) function_create_resources([type.capitalize, { item => params }]) end The documentation of create_resources doesn't say anything how it handles undef. I would expect, that it means that the attribute is set to undef, but I'm not sure. Add Comment This message was sent by Atlassian JIRA (v6.4.13#64028-sha1:b7939e9) -- 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
Jira (PUP-6422) ensure_resource not longer working with undef parameters
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-6422 ensure_resource not longer working with undef parameters Change By: Henrik Lindberg Sprint: Language Triage Scrum Team: Language Add Comment This message was sent by Atlassian JIRA (v6.4.13#64028-sha1:b7939e9) -- 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-6422) ensure_resource not longer working with undef parameters
Title: Message Title Henrik Lindberg assigned an issue to Reinhard Vicinus Puppet / PUP-6422 ensure_resource not longer working with undef parameters Change By: Henrik Lindberg Assignee: Reinhard Vicinus Add Comment This message was sent by Atlassian JIRA (v6.4.13#64028-sha1:b7939e9) -- 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-6422) ensure_resource not longer working with undef parameters
Title: Message Title Henrik Lindberg commented on PUP-6422 Re: ensure_resource not longer working with undef parameters What is the expected behavior of passing undef for the value of an attribute in this situation? It can mean two different things: the attribute should be set to undef i don't have a value for the attribute (the same as if the attribute was not present in the hash) Add Comment This message was sent by Atlassian JIRA (v6.4.13#64028-sha1:b7939e9) -- 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-6422) ensure_resource not longer working with undef parameters
Title: Message Title Reinhard Vicinus created an issue Puppet / PUP-6422 ensure_resource not longer working with undef parameters Issue Type: Bug Affects Versions: PUP 4.5.2 Assignee: Unassigned Created: 2016/06/21 7:32 AM Priority: Normal Reporter: Reinhard Vicinus With 4.5.2 the using ensure_resource not longer works with parameters which have the value undef: puppet apply -e 'ensure_resource("file", "/tmp/a", { owner => undef }) ensure_resource("file", "/tmp/a", { owner => undef })' Error: Evaluation Error: Error while evaluating a Function Call, Duplicate declaration: File[/tmp/a] is already declared; cannot redeclare at line 1:55 on node test