Jira (PUP-3732) type validation should not run for `puppet resource`

2017-10-16 Thread Henrik Lindberg (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Henrik Lindberg updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-3732 
 
 
 
  type validation should not run for `puppet resource`  
 
 
 
 
 
 
 
 
 

Change By:
 
 Henrik Lindberg 
 
 
 

Component/s:
 
 Types and Providers 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-3732) type validation should not run for `puppet resource`

2017-10-14 Thread William Yardley (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 William Yardley commented on  PUP-3732 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: type validation should not run for `puppet resource`  
 
 
 
 
 
 
 
 
 
 
I believe these describe a similar issue as well: https://github.com/voxpupuli/puppet-rabbitmq/issues/147 https://github.com/voxpupuli/puppet-rabbitmq/pull/651 Having a validate block in the type causes puppet resource foo to fail 
In those cases, moving validation to #create in the provider seems to work as a workaround, but is not ideal. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-3732) type validation should not run for `puppet resource`

2017-06-19 Thread Hunter (Hunner) Haugen (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Hunter (Hunner) Haugen commented on  PUP-3732 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: type validation should not run for `puppet resource`  
 
 
 
 
 
 
 
 
 
 
Josh Cooper I see occurrences of this at least in the F5, netapp, and Azure modules, if you want code examples. Otherwise specific scenarios may not help as it's a "gotcha" any time I'm coding any global validate block (and especially having to make "required" parameters since there is no way to make required parameters for puppet types otherwise). Eg: 
 
 
 
 
 
 
validate do 
 
 
 
 
  raise ArgumentError, "Passing value or othervalue is required" if ! self[:value] and ! self[:othervalue] 
 
 
 
 
end
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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 

Jira (PUP-3732) type validation should not run for `puppet resource`

2017-06-19 Thread Bernhard Frauendienst (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Bernhard Frauendienst commented on  PUP-3732 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: type validation should not run for `puppet resource`  
 
 
 
 
 
 
 
 
 
 
Taylan Develioglu, it turns out that checking for managed? does not help (at least not in all cases), because even for managed resources the above situation occurs, where the resource is created but validation is called before properties are set. However, the resources is already marked as managed. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-3732) type validation should not run for `puppet resource`

2017-06-19 Thread Bernhard Frauendienst (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Bernhard Frauendienst commented on  PUP-3732 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: type validation should not run for `puppet resource`  
 
 
 
 
 
 
 
 
 
 
Taylan Develioglu thanks, that's good to know! However, in my case, even for unmanaged resources that validated invariant always holds true, so guarding for managed resources would just be working around implementation details. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-3732) type validation should not run for `puppet resource`

2017-06-19 Thread Taylan Develioglu (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Taylan Develioglu commented on  PUP-3732 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: type validation should not run for `puppet resource`  
 
 
 
 
 
 
 
 
 
 
Just wanted to chime that you can guard against this behavior by checking if the resource is managed. e.g.: 
 
 
 
 
 
 
  validate do 
 
 
 
 
if managed? 
 
 
 
 
  unless self[:value] 
 
 
 
 
raise ArgumentError, 'Active_value must be set' 
 
 
 
 
  end 
 
 
 
 
end 
 
 
 
 
  end
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 

Jira (PUP-3732) type validation should not run for `puppet resource`

2017-06-19 Thread Bernhard Frauendienst (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Bernhard Frauendienst commented on  PUP-3732 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: type validation should not run for `puppet resource`  
 
 
 
 
 
 
 
 
 
 

This should still work for normal catalog application, as a resource returned by self.instances and thus passing global validation is already configured correctly.
 
Are you sure about this? I've encountered the same issue with resources created by self.instances when trying to purge them with resources.  
I tried to follow the code, the resources are created in self.instances @ type.rb#L1174 with just a name and a provider, and are then validated in initialize @ type.rb#L2398. I can't see where the values from the provider would be set inbetween, and given that the validation fails, this does not seem to be the case. Then again, I'm very new to the Ruby language. Am I missing something here? 
I've checked most built-in types, and none of them have a global validate block that would not work if the values are not set. That would explain why this never was reported with a built-in type. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-3732) type validation should not run for `puppet resource`

2017-05-18 Thread Moses Mendoza (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Moses Mendoza updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-3732 
 
 
 
  type validation should not run for `puppet resource`  
 
 
 
 
 
 
 
 
 

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-3732) type validation should not run for `puppet resource`

2017-05-15 Thread Sean McDonald (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Sean McDonald updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-3732 
 
 
 
  type validation should not run for `puppet resource`  
 
 
 
 
 
 
 
 
 

Change By:
 
 Sean McDonald 
 
 
 

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-3732) type validation should not run for `puppet resource`

2017-05-15 Thread Sean McDonald (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Sean McDonald updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-3732 
 
 
 
  type validation should not run for `puppet resource`  
 
 
 
 
 
 
 
 
 

Change By:
 
 Sean McDonald 
 
 
 

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-3732) type validation should not run for `puppet resource`

2017-05-15 Thread Josh Cooper (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Josh Cooper commented on  PUP-3732 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: type validation should not run for `puppet resource`  
 
 
 
 
 
 
 
 
 
 
Hunter (Hunner) Haugen, Ben Roberts Agree this is a problem, can you provide examples of where you've run into this? 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-3732) type validation should not run for `puppet resource`

2016-10-13 Thread Ben Roberts (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Ben Roberts commented on  PUP-3732 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: type validation should not run for `puppet resource`  
 
 
 
 
 
 
 
 
 
 
Having just lost about 6 hours to debugging this exact same issue, issue still present in 4.7.0. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-3732) type validation should not run for `puppet resource`

2014-12-24 Thread Hunter Haugen (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Hunter Haugen updated an issue 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 Puppet /  PUP-3732 
 
 
 
  type validation should not run for `puppet resource`  
 
 
 
 
 
 
 
 
 

Change By:
 
 Hunter Haugen 
 
 
 

Summary:
 
 typevalidationshould rot not runfor`puppetresource` 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 
 
 

 This message was sent by Atlassian JIRA (v6.3.10#6340-sha1:7ea293a) 
 
 
 
 
  
 
 
 
 
 
 
 
 
   





-- 
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-3732) type validation should rot run for `puppet resource`

2014-12-03 Thread Hunter Haugen (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Hunter Haugen created an issue 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 Puppet /  PUP-3732 
 
 
 
  type validation should rot run for `puppet resource`  
 
 
 
 
 
 
 
 
 

Issue Type:
 
  Bug 
 
 
 

Assignee:
 

 Unassigned 
 
 
 

Created:
 

 2014/12/03 12:41 PM 
 
 
 

Priority:
 
  Normal 
 
 
 

Reporter:
 
 Hunter Haugen 
 
 
 
 
 
 
 
 
 
 
tl;dr: puppet resource creates resource types without attributes, which causes the type's global validate block to fail. It should initialize the type with values from the provider so that it can be validated. 
Puppet types can have per-parameter or per-property validate blocks, but can also have a global validate block. 
Oddly, when running puppet resource whatever the per-attribute validates are not called (as no attributes are passed), but the global validate is. Validation is usually done on the resource coming from the catalog, which is self in the context of the global validate. When using puppet resource there is no true catalog per-say, but if no arguments are passed then the resource types @parameter hash is not initialized and thus validation will fail. 
If the @parameter hash was merged with the values from self.provider's @property_hash then the global validation block would still be validating any values that were passed on the command-line, or just the values returned by self.instances if there are no arguments. 
This *should* still work for normal catalog application, as a resource returned by self.instances and thus passing global validation is already configured correctly.