Jira (PUP-7406) Add kind assert in custom data types?

2017-05-18 Thread Henrik Lindberg (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Henrik Lindberg commented on  PUP-7406 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Add kind assert in custom data types?  
 
 
 
 
 
 
 
 
 
 
The features this idea resembles is the assertions planned for Pcore. (See PUP-7279) 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-7406) Add kind assert in custom data types?

2017-05-17 Thread Ethan Brown (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Ethan Brown updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-7406 
 
 
 
  Add kind assert in custom data types?  
 
 
 
 
 
 
 
 
 

Change By:
 
 Ethan Brown 
 
 
 

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-7406) Add kind assert in custom data types?

2017-05-17 Thread Ethan Brown (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Ethan Brown updated an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-7406 
 
 
 
  Add kind assert in custom data types?  
 
 
 
 
 
 
 
 
 

Change By:
 
 Ethan Brown 
 
 
 

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-7406) Add kind assert in custom data types?

2017-03-31 Thread Francois Lafont (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Francois Lafont commented on  PUP-7406 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Add kind assert in custom data types?  
 
 
 
 
 
 
 
 
 
 
Ok. Object and the derive... I look forward to test that.  I keep the idea to add constraints in data types in my head and I will test with the Object data type when the time has come. 
Feel free to close this ticket if it's the simplest for you. Thanks again. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-7406) Add kind assert in custom data types?

2017-03-31 Thread Henrik Lindberg (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Henrik Lindberg commented on  PUP-7406 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Add kind assert in custom data types?  
 
 
 
 
 
 
 
 
 
 
ok, got it. We are talking about being able to write new kinds of types with additional constraints here. This is currently not possible - the type would need to be implemented in Ruby and be part of Puppet core. 
What is coming though is an Object type and the ability to derive from those. For an object there modeling things like assertions of invariants (for example: both a && b cannot be false) is possible. This is in Puppet currently, but it is experimental and we have not shared any documentation on it yet. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-7406) Add kind assert in custom data types?

2017-03-31 Thread Francois Lafont (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Francois Lafont commented on  PUP-7406 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Add kind assert in custom data types?  
 
 
 
 
 
 
 
 
 
 
Sorry but assert_type doesn't match with my request here. 
Maybe my example in my first message was too complicated. Let me show you another one. Imagine I would like to define this type Mymodule::Custom: 
 
 
 
 
 
 
# The content of mymodule/types/custom.pp 
 
 
 
 
  
 
 
 
 
type Mymodule::Custom = Struct[{ 
 
 
 
 
  'a' => Boolean, 
 
 
 
 
  'b' => Boolean, 
 
 
 
 
}]
 
 
 
 
 
 
 
But, in addition, I would like to prohibit this value (it's just an example): 
 
 
 
 
 
 
{ 
 
 
 
 
  'a' => false, 
 
 
 
 
  'b' => false, 
  

Jira (PUP-7406) Add kind assert in custom data types?

2017-03-31 Thread Henrik Lindberg (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Henrik Lindberg commented on  PUP-7406 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
  Re: Add kind assert in custom data types?  
 
 
 
 
 
 
 
 
 
 
There is already a assert_type function in puppet that checks if value matches type and that calls a lambda if not. Without the lambda it gives a generic explanation of the type mismatch. The lambda can contain logic that gives a custom error. 
Closing this, please reopen if assert_type does not work for you. 
Note that there is no way to associate a custom error message with a user defined type when puppet is doing automatic argument type checking. In 4x ruby functions there is now a way to add custom type mismatch errors - the solution there is not easily transferable to the puppet language where we need to come up with some other form of describing an overload. One solution that we may consider is to extend the type system to allow things like this to be specified in the type itself. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-7406) Add kind assert in custom data types?

2017-03-29 Thread Francois Lafont (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Francois Lafont created an issue 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 Puppet /  PUP-7406 
 
 
 
  Add kind assert in custom data types?  
 
 
 
 
 
 
 
 
 

Issue Type:
 
  New Feature 
 
 
 

Assignee:
 

 Unassigned 
 
 
 

Created:
 

 2017/03/29 10:40 AM 
 
 
 

Priority:
 
  Normal 
 
 
 

Reporter:
 
 Francois Lafont 
 
 
 
 
 
 
 
 
 
 
Hi, 
It could be handy to be able to add some "assert" in custom data types. For instance in mymodule/types/vlan.pp something like that: 
 
 
 
 
 
 
type Mymodule::Vlan = Struct[{ 
 
 
 
 
  'name' => String[1], 
 
 
 
 
  'id'   => Integer[1], 
 
 
 
 
  Optional['http_proxy'] => String[1],