Jira (PUP-8513) Cannot add a resource parameter, when a default resource declaration already defines this param

2018-03-11 Thread Henrik Lindberg (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Henrik Lindberg commented on  PUP-8513  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Cannot add a resource parameter, when a default resource declaration already defines this param   
 

  
 
 
 
 

 
 Agree, It is confusing, and inconsistent. The behaviour you are seeing comes indeed from old code (not cleaned up code) for which there is no real specification and subsequently no tests that asserts the specified behaviour. At some point it got changed because one of the side effects of what it ended up doing was considered bad. This is because the expectancies for defaults, overrides, given values and APL, and the rules for what holds true in the "same scope", and "inherited scope" clashes, that some things are evaluated lazily but others are immediate. The old logic has if-then-else spaghetti that tries to patch things up as ambiguities and strange behaviour was observed over time. It is not good, and I would very much like to clean up the rest of the strange behavior in the compiler. I don't mind broad, global resource defaults, but I think they should apply immediately for values that are not given and not available via APL. There also needs to be a way to set their scope and precedence. One such has been suggested, but there no agreement on a way forward. (There are tickets logged with these suggestions and issues related to the 3.x compiler logic - there is an epic called "Biff the Catalog Builder" where these have been collected. Fixing these means breakage though, and after the 3.x to 4.x upgrade there is reluctance to deal with a new set of breaking changes. At some point I think we can as people have evolved their logic to the newer best practices and thus avoiding some of the issues (and thereby reducing the problems of upgrading). Personally I would like overrides to be removed from the language. There is however no better solution available for some very legit use cases. And, if we are to have overrides, since we have a collector that can override anything at any time, we could just as well allow the Resource[title] syntax to also override the same way. There are however other issues here as well - you can override parameters to a defined resource, but you can do so after it has been evaluated - then only its input parameters are changed, but the body of code is not re-evaluated (because it cannot really due to side effects of already having created its contained resources).  If we keep overrides, the rules need to be made clear where you are allowed to override - for example from a context that is clearly at a higher level and it can be argued that code in that location "knows what is right" - still complex to do in a mix of imperative and "declarative" evaluation. Meanwhile, as you said - the documentation that says that you cannot override a "managed variable" needs to state that native resources having gotten a value for one of its attributes from a default considers that to be managed and thus cannot be changed.   
 

  
 
 
 
 

 
 
 

 
 
  

Jira (PUP-8513) Cannot add a resource parameter, when a default resource declaration already defines this param

2018-03-11 Thread Henrik Lindberg (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Henrik Lindberg updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-8513  
 
 
  Cannot add a resource parameter, when a default resource declaration already defines this param   
 

  
 
 
 
 

 
Change By: 
 Henrik Lindberg  
 
 
Component/s: 
 DOCS  
 

  
 
 
 
 

 
 
 

 
 
 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-8513) Cannot add a resource parameter, when a default resource declaration already defines this param

2018-03-11 Thread Peter Meier (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Peter Meier assigned an issue to Unassigned  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-8513  
 
 
  Cannot add a resource parameter, when a default resource declaration already defines this param   
 

  
 
 
 
 

 
Change By: 
 Peter Meier  
 
 
Assignee: 
 Peter Meier  
 

  
 
 
 
 

 
 
 

 
 
 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-8513) Cannot add a resource parameter, when a default resource declaration already defines this param

2018-03-11 Thread Henrik Lindberg (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Henrik Lindberg commented on  PUP-8513  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Cannot add a resource parameter, when a default resource declaration already defines this param   
 

  
 
 
 
 

 
 Sorry, misread the code - the override is indeed inside of the class scope that declares the resource it is overriding. The error comes from applying the override:  
 
 
 
 
 /Users/henrik/git/puppet/lib/puppet/parser/resource.rb:377:in `override_parameter'
  
 
 
 
  And it occurs even if the override is placed before the resource. I asked if this every worked because there has been a series of changes / fixes to the order in which values are assigned to resource attributes, and in particular when defaults are applied. Thus, what happens is that the override fails because the default attribute is already assigned.  You can use a collector to override since it can override already managed attributes.  
 
 
 
 
 File <| title == '/tmp/puppet-test' |> {  
 
 
 ignore => '*.bak2'  
 
 
  }
  
 
 
 
  Note that there is a difference if the override is for a native type or a define since the defines are lazily evaluated and therefore have not received their default values until after the class body is completely evaluated. So, this works because the override is evaluated before the resource MyFile is evaluated.  
 
 
 
 
 File {  
 
 
   ignore => '*.bak'  
 
 
 }  

Jira (PUP-8513) Cannot add a resource parameter, when a default resource declaration already defines this param

2018-03-11 Thread Henrik Lindberg (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Henrik Lindberg assigned an issue to Peter Meier  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-8513  
 
 
  Cannot add a resource parameter, when a default resource declaration already defines this param   
 

  
 
 
 
 

 
Change By: 
 Henrik Lindberg  
 
 
Assignee: 
 Henrik Lindberg Peter Meier  
 

  
 
 
 
 

 
 
 

 
 
 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-8513) Cannot add a resource parameter, when a default resource declaration already defines this param

2018-03-10 Thread Peter Meier (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Peter Meier assigned an issue to Henrik Lindberg  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-8513  
 
 
  Cannot add a resource parameter, when a default resource declaration already defines this param   
 

  
 
 
 
 

 
Change By: 
 Peter Meier  
 
 
Assignee: 
 Peter Meier Henrik Lindberg  
 

  
 
 
 
 

 
 
 

 
 
 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-8513) Cannot add a resource parameter, when a default resource declaration already defines this param

2018-03-10 Thread Peter Meier (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Peter Meier commented on  PUP-8513  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Cannot add a resource parameter, when a default resource declaration already defines this param   
 

  
 
 
 
 

 
 I can't say whether it ever worked, because it was new code I added that failed. But I have similar code patterns that are working for a long time and still work. But it was likely the first time I added such a piece of code with a resource default _expression_ setting the particular param in site.pp. 

The override of the resource occurs outside the scope of the containing class of the resource (and is also not within a scope that inherits from the declaring class.
 I don't understand why you are saying that the override of the resource occurs outside the scope of the containing class. There is only one class and except for the resource default both param declaration are within the same class.  
 

  
 
 
 
 

 
 
 

 
 
 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-8513) Cannot add a resource parameter, when a default resource declaration already defines this param

2018-03-09 Thread Henrik Lindberg (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Henrik Lindberg commented on  PUP-8513  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Cannot add a resource parameter, when a default resource declaration already defines this param   
 

  
 
 
 
 

 
 The first example uses a resource default _expression_ and then a resource override _expression_. The override of the resource occurs outside the scope of the containing class of the resource (and is also not within a scope that inherits from the declaring class. That override is not legal in the puppet language. Hence my question if this ever worked - I think you are simply encountering a valid error and that you need to do what you intended some other way.  Just in case - this is the resource override _expression_:  
 
 
 
 
   File['/tmp/puppet-test']{  
 
 
 ignore => '*.bak2',  
 
 
   }
  
 
 
 
   
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)  
 
 

 
   
 

   

Jira (PUP-8513) Cannot add a resource parameter, when a default resource declaration already defines this param

2018-03-09 Thread Henrik Lindberg (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Henrik Lindberg commented on  PUP-8513  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Cannot add a resource parameter, when a default resource declaration already defines this param   
 

  
 
 
 
 

 
 Is this something that has worked before? If so, in which version?  
 

  
 
 
 
 

 
 
 

 
 
 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-8513) Cannot add a resource parameter, when a default resource declaration already defines this param

2018-03-09 Thread Henrik Lindberg (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Henrik Lindberg assigned an issue to Peter Meier  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-8513  
 
 
  Cannot add a resource parameter, when a default resource declaration already defines this param   
 

  
 
 
 
 

 
Change By: 
 Henrik Lindberg  
 
 
Assignee: 
 Peter Meier  
 

  
 
 
 
 

 
 
 

 
 
 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-8513) Cannot add a resource parameter, when a default resource declaration already defines this param

2018-03-05 Thread Peter Meier (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Peter Meier created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Puppet /  PUP-8513  
 
 
  Cannot add a resource parameter, when a default resource declaration already defines this param   
 

  
 
 
 
 

 
Issue Type: 
  Bug  
 
 
Affects Versions: 
 PUP 5.4.0  
 
 
Assignee: 
 Unassigned  
 
 
Components: 
 Language  
 
 
Created: 
 2018/03/05 11:43 PM  
 
 
Priority: 
  Normal  
 
 
Reporter: 
 Peter Meier  
 

  
 
 
 
 

 
 The following manifests fails with the error:  
 
 
 
 
 Error: Parameter 'ignore' is already set on File[/tmp/puppet-test] by # at /tmp/foo.pp:3; cannot redefine at /tmp/foo.pp:13 on node bla  
 
 
 
  Manifest:  
 
 
 
 
 File {  
 
 
   ignore => '*.bak'