Jira (PUP-5965) Add 'new instance' operation
Title: Message Title Garrett Guillotte commented on PUP-5965 Re: Add 'new instance' operation DOCUMENT-817 adds documentation for using new() to convert strings to numbers. DOCUMENT-822 should assess documentation for other places where uses of new() should add to or replace existing docs elsewhere. Add Comment This message was sent by Atlassian JIRA (v7.5.1#75006-sha1:7df2574) -- 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-5965) Add 'new instance' operation
Title: Message Title Garrett Guillotte updated an issue Puppet / PUP-5965 Add 'new instance' operation Change By: Garrett Guillotte Component/s: DOCS Add Comment This message was sent by Atlassian JIRA (v7.5.1#75006-sha1:7df2574) -- 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-5965) Add 'new instance' operation
Title: Message Title Eric Thompson updated an issue Puppet / PUP-5965 Add 'new instance' operation Change By: Eric Thompson QA Status: Reviewed 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-5965) Add 'new instance' operation
Title: Message Title Eric Thompson updated an issue Puppet / PUP-5965 Add 'new instance' operation Change By: Eric Thompson QA Risk Assessment: High 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-5965) Add 'new instance' operation
Title: Message Title Henrik Lindberg commented on PUP-5965 Re: Add 'new instance' operation Logged PUP-6131 for the problem with NotUndef 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-5965) Add 'new instance' operation
Title: Message Title Henrik Lindberg commented on PUP-5965 Re: Add 'new instance' operation The behavior for NotUndef is wrong. I am opening a separate ticket for that. 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-5965) Add 'new instance' operation
Title: Message Title Eric Thompson commented on PUP-5965 Re: Add 'new instance' operation (ohhh, i see) validated at master puppet-agent SHA: 24fbcbdd0cf7bc7acc15d099cd6fd12e7157 on rhel7 some concern surrounding puppet apply -e '$point = NotUndef(1) notice($point)' below [root@bfpyhi2meslrtdv ~]# puppet apply -e '$point = String.new("hello there") notice($point)' Notice: Scope(Class[main]): hello there Notice: Compiled catalog for bfpyhi2meslrtdv.delivery.puppetlabs.net in environment production in 0.04 seconds Notice: Applied catalog in 0.01 seconds [root@bfpyhi2meslrtdv ~]# puppet apply -e '$point = String("hello there") notice($point)' Notice: Scope(Class[main]): hello there Notice: Compiled catalog for bfpyhi2meslrtdv.delivery.puppetlabs.net in environment production in 0.04 seconds Notice: Applied catalog in 0.01 seconds [root@bfpyhi2meslrtdv ~]# puppet apply -e '$point = String(false) notice($point)'
Jira (PUP-5965) Add 'new instance' operation
Title: Message Title Eric Thompson assigned an issue to Eric Thompson Puppet / PUP-5965 Add 'new instance' operation Change By: Eric Thompson Assignee: qa Eric Thompson 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-5965) Add 'new instance' operation
Title: Message Title Henrik Lindberg commented on PUP-5965 Re: Add 'new instance' operation Well, Point does not exist, so not meaningful to test If it existed (and since we do not yet have Object type), it can only be a resource type (as the error says). The new function does not support creating new instances of resources. You can create a new instance of a Struct, Hash, Array, Tuple, String, Boolean, Numeric, Integer, Float, and to Optional[T], and NotUndef[T], where T is one of the supported types. I am sorry the description is misleading - will edit to make it easier to document (although, the documentation is in the documentation of the new function). 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-5965) Add 'new instance' operation
Title: Message Title Eric Thompson commented on PUP-5965 Re: Add 'new instance' operation i should have mentioned i tried it as a non-alias as well: [root@lj9slbazffh4fis ~]# puppet apply -e '$point = Point({x => 0, y => 0})' Error: Evaluation Error: Resource type not found: Point at line 1:10 on node lj9slbazffh4fis.delivery.puppetlabs.net but i'm not clear on how to setup a new Type using puppet 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-5965) Add 'new instance' operation
Title: Message Title Henrik Lindberg commented on PUP-5965 Re: Add 'new instance' operation Eric Thompson It is not implemented for type aliases. When the description uses "MyType" it is intended as a real type (when we have ObjectType). We should probably allow new to operate on an alias. Will create a ticket for that. 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-5965) Add 'new instance' operation
Title: Message Title Eric Thompson commented on PUP-5965 Re: Add 'new instance' operation i'm probably missing some syntax details, but i can't get this to work: [root@lj9slbazffh4fis ~]# puppet apply -e 'type Point = Struct[{x=>Integer, y=>Integer}]; $point = Point({x => 0, y => 0} )' Error: Evaluation Error: Error while evaluating a Function Call, Creation of new instance of type 'Point' is not supported at line 1:57 on node lj9slbazffh4fis.delivery.puppetlabs.net [root@lj9slbazffh4fis ~]# puppet apply -e 'type Point = Struct[{x=>Integer, y=>Integer}]; $point = Point.new({x => 0, y = > 0})' Error: Evaluation Error: Error while evaluating a Method call, Creation of new instance of type 'Point' is not supported at line 1:66 on node lj9slbazffh4fis.delivery.puppetlabs.net Add Comment
Jira (PUP-5965) Add 'new instance' operation
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-5965 Add 'new instance' operation Change By: Henrik Lindberg With the additions being made to the type system to handle more advanced data types there is the need to be able to create new instances of such types from arguments.There are two use-cases - although quite similar:* in regular logic* building a data structureBasically the operation is implemented as a 'new' function:{code:puppet}MyType.new(args){code}Which is also available as a call to the type itself:{code:puppet}MyType(args){code}It is up to each type what arguments it takes. Some are simple "value" data types, others are quite complex.The implementation of the {{new}} function shows the signatures and options for all type in the Puppet type system.The short form (calling type directly) is intended to suite embedding of instances in a data structure:{code:puppet}MyType({x_value => 1, y_value =>2, z_value =>3})# which would be equivalent to:MyType.new(1,2,3){code}Thus, in a data structure it becomes natural to use the more declarative looking "by name" style:{code: puppet}$routes = [ Route({ points => [Point({x => 0, y => 0}), Point({x=>10, y=>10}), Route({ points => [Point({x => 2, y => 7}), Point({x=>32, y=>42}), ]{code}This ticket includes adding sane default constructors for all types in the type system as well as advanced formats for various conversions. (See the documentation for the {{new}} function.ACCEPTANCE CRITERIA* Both long {{Type.new(...)}} and short {{Type(...)}} forms work* Common conversion tasks are simple - e.g. {{String(false)}}, {{Integer("42")}}* Collections are converted to "programmatic" style for contained values (i.e. strings are quoted) by default ** form for contained values can be overridden** delimiters are configurable** indentation is possible for increased readability* Booleans, and Undef can be converted to/from in different forms, "true"/"false", "yes"/"no", "undef", "undefined", "", etc.** results can be in keyword style or quoted* Formatting can be based on the type of the value** different format depending on lengths; e.g. indent long arrays** quoting strings containing spaces but not others * All types can be converted to string * That unit tests are comprehensive Add Comment
Jira (PUP-5965) Add 'new instance' operation
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-5965 Add 'new instance' operation Change By: Henrik Lindberg With the additions being made to the type system to handle more advanced data types there is the need to be able to create new instances of such types from arguments.There are two use-cases - although quite similar:* in regular logic* building a data structureBasically the operation can be is implemented as a 'new' function:{code:puppet}MyType.new(args){code} This constructor may however not be ideal as it Which is also available as a call to the type itself:{code:puppet}MyType( args by position based, and if there are many ){code}It is up to each type what arguments and optionality involved it gets difficult (and verbose) when using this in a takes. Some are simple "value" data structure types, others are quite complex . Therefore, we should also support The implementation of the ' {{new}} function shows the signatures and options for all type in the Puppet type system.The short form ' which (calling type directly) is a "call intended to suite embedding of instances in a type". In this form, the arguments are given as a hash with arg/attribute to value mappings. data structure: {code:puppet}MyType({x_value => 1, y_value =>2, z_value =>3})# which would be equivalent to:MyType.new(1,2,3) # But since it is "by name", this works fine (given that z_value is optional/has default)MyType( { y_value =>2, x_value =>1}){ code}Thus, in a data structure it becomes natural to use the more declarative looking "by name" style:{code: puppet}$routes = [ Route({ points => [Point({x => 0, y => 0}), Point({x=>10, y=>10}), Route({ points => [Point({x => 2, y => 7}), Point({x=>32, y=>42}), ]{code}This ticket includes adding sane default constructors for all types in the type system as well as advanced formats for various conversions . The constructors should be (See the documentation for the {{new}} function.ACCEPTANCE CRITERIA* Both long {{Type.new(...)}} and short {{Type(...)}} forms work* Common conversion tasks are simple - e.g. {{String(false)}}, {{Integer("42")}}* Collections are converted to "programmatic" style for contained values (i.e. strings are quoted)** form for contained values can be overridden** delimiters are configurable** indentation is possible for increased readability* Booleans, and strict Undef can be converted to/from in different forms, "true"/"false", "yes"/"no", "undef", "undefined", "", etc . Flexibility should instead ** results can be available in keyword style or quoted* Formatting can be based on the type converter logic of the value** different format depending on lengths; e . g. indent long arrays** quoting strings containing spaces but not others* That unit tests are comprehensive
Jira (PUP-5965) Add 'new instance' operation
Title: Message Title Peter Huene assigned an issue to qa Puppet / PUP-5965 Add 'new instance' operation Change By: Peter Huene Status: Ready for CI Test Assignee: qa 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-5965) Add 'new instance' operation
Title: Message Title Thomas Hallgren assigned an issue to Unassigned Puppet / PUP-5965 Add 'new instance' operation Change By: Thomas Hallgren Assignee: Thomas Hallgren 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-5965) Add 'new instance' operation
Title: Message Title Thomas Hallgren commented on PUP-5965 Re: Add 'new instance' operation Merged to master at d5b65c6. 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-5965) Add 'new instance' operation
Title: Message Title Henrik Lindberg assigned an issue to Thomas Hallgren Puppet / PUP-5965 Add 'new instance' operation Change By: Henrik Lindberg Assignee: Henrik Lindberg Thomas Hallgren 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-5965) Add 'new instance' operation
Title: Message Title Thomas Hallgren assigned an issue to Henrik Lindberg Puppet / PUP-5965 Add 'new instance' operation Change By: Thomas Hallgren Assignee: Thomas Hallgren Henrik Lindberg 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-5965) Add 'new instance' operation
Title: Message Title Henrik Lindberg assigned an issue to Thomas Hallgren Puppet / PUP-5965 Add 'new instance' operation Change By: Henrik Lindberg Assignee: Henrik Lindberg Thomas Hallgren 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-5965) Add 'new instance' operation
Title: Message Title Thomas Hallgren assigned an issue to Henrik Lindberg Puppet / PUP-5965 Add 'new instance' operation Change By: Thomas Hallgren Assignee: Thomas Hallgren Henrik Lindberg 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-5965) Add 'new instance' operation
Title: Message Title Thomas Hallgren assigned an issue to Thomas Hallgren Puppet / PUP-5965 Add 'new instance' operation Change By: Thomas Hallgren Assignee: Thomas Hallgren 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-5965) Add 'new instance' operation
Title: Message Title Steve Barlow updated an issue Puppet / PUP-5965 Add 'new instance' operation Change By: Steve Barlow Sprint: Language 2016-03-23 , Language 2016-04-06 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-5965) Add 'new instance' operation
Title: Message Title Henrik Lindberg assigned an issue to Henrik Lindberg Puppet / PUP-5965 Add 'new instance' operation Change By: Henrik Lindberg Assignee: Henrik Lindberg Add Comment This message was sent by Atlassian JIRA (v6.4.12#64027-sha1:e3691cc) -- 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-5965) Add 'new instance' operation
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-5965 Add 'new instance' operation Change By: Henrik Lindberg Sprint: Language 2016-03- 09 (Burn CF) 23 Add Comment This message was sent by Atlassian JIRA (v6.4.12#64027-sha1:e3691cc) -- 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-5965) Add 'new instance' operation
Title: Message Title Henrik Lindberg updated an issue Puppet / PUP-5965 Add 'new instance' operation Change By: Henrik Lindberg With the additions being made to the type system to handle more advanced data types there is the need to be able to create new instances of such types from arguments.There are two use-cases - although quite similar:* in regular logic* building a data structureBasically the operation can be implemented as a 'new' function:{code:puppet}MyType.new(args){code}This constructor may however not be ideal as it is args by position based, and if there are many arguments and optionality involved it gets difficult (and verbose) when using this in a data structure. Therefore, we should also support the 'short form' which is a "call to a type". In this form, the arguments are given as a hash with arg/attribute to value mappings.{code:puppet}MyType({x_value => 1, y_value =>2, z_value =>3})# which would be equivalent to:MyType.new(1,2,3)# But since it is "by name", this works fine (given that z_value is optional/has default)MyType({y_value =>2, x_value =>1}){code}Thus, in a data structure it becomes natural to use the more declarative looking "by name" style: [ { code: puppet}$routes = [ Route({ points => [Point({x => 0, y => 0}), Point({x=>10, y=>10}), Route({ points => [Point({x => 2, y => 7}), Point({x=>32, y=>42}), ]{code}This ticket includes adding sane default constructors for all types in the type system. The constructors should be simple and strict. Flexibility should instead be available in the type converter logic. Add Comment This message was sent by Atlassian JIRA (v6.4.12#64027-sha1:e3691cc)
Jira (PUP-5965) Add 'new instance' operation
Title: Message Title Henrik Lindberg created an issue Puppet / PUP-5965 Add 'new instance' operation Issue Type: New Feature Assignee: Unassigned Created: 2016/02/24 7:11 AM Fix Versions: PUP 4.5.0 Priority: Normal Reporter: Henrik Lindberg With the additions being made to the type system to handle more advanced data types there is the need to be able to create new instances of such types from arguments. There are two use-cases - although quite similar: in regular logic building a data structure Basically the operation can be implemented as a 'new' function: MyType.new(args)