Jira (PUP-3978) Change how block is passed to avoid confusion with missing optional parameters

2015-02-13 Thread Eric Thompson (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Eric Thompson assigned an issue to Eric Thompson 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 Puppet /  PUP-3978 
 
 
 
  Change how block is passed to avoid confusion with missing optional parameters  
 
 
 
 
 
 
 
 
 

Change By:
 
 Eric Thompson 
 
 
 

Assignee:
 
 EricThompson 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-3978) Change how block is passed to avoid confusion with missing optional parameters

2015-02-13 Thread Eric Thompson (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Eric Thompson commented on  PUP-3978 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
  Re: Change how block is passed to avoid confusion with missing optional parameters  
 
 
 
 
 
 
 
 
 
 
verified on rhel7 at SHA: e46fb00 
others: note the code block here is all puppet. the function is ruby, obviously. the call to yield implicitly finds the block reference. to have the optional arguments work properly arg_count() is required 
 
 
 
 
 
 
[root@w6bj64gi8xne3xr functions]# puppet apply -e 'test(3) |$x| {notice(should be second arg: $x)}' 
 
 
 
 
passed a (first arg): 3 
 
 
 
 
passed b (optional arg): 4 
 
 
 
 
Notice: Scope(Class[main]): should be second arg: 4 
 
 
 
 
Notice: Compiled catalog for w6bj64gi8xne3xr.delivery.puppetlabs.net in environment production in 0.37 seconds 
 
 
 
 
Notice: Applied catalog in 0.01 seconds 
 
 
 
 
[root@w6bj64gi8xne3xr functions]# puppet apply -e 'test(3,6) |$x| {notice(should be second arg: $x)}' 
 
 
 
 
passed a (first arg): 3 
 
 
 
 
passed b (optional arg): 6 
 
 
   

Jira (PUP-3978) Change how block is passed to avoid confusion with missing optional parameters

2015-02-13 Thread Eric Thompson (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Eric Thompson commented on  PUP-3978 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
  Re: Change how block is passed to avoid confusion with missing optional parameters  
 
 
 
 
 
 
 
 
 
 
verified on ubuntu14.04 at SHA: e46fb00 
 
 
 
 
 
 
root@vb9b8r45w9v9pkp:/usr/local/lib/site_ruby/1.9.1/puppet/functions# puppet apply -e 'test(3) |$x| {notice(should be second arg: $x)}' 
 
 
 
 
passed a (first arg): 3 
 
 
 
 
passed b (optional arg): 4 
 
 
 
 
Notice: Scope(Class[main]): should be second arg: 4 
 
 
 
 
Notice: Compiled catalog for vb9b8r45w9v9pkp.delivery.puppetlabs.net in environment production in 0.36 seconds 
 
 
 
 
Notice: Applied catalog in 0.01 seconds 
 
 
 
 
root@vb9b8r45w9v9pkp:/usr/local/lib/site_ruby/1.9.1/puppet/functions# puppet apply -e 'test(3, 42) |$x| {notice(should be second arg: $x)}' 
 
 
 
 
passed a (first arg): 3 
 
 
 
 
passed b (optional arg): 42 
 
 
 
 

Jira (PUP-3978) Change how block is passed to avoid confusion with missing optional parameters

2015-02-13 Thread Eric Thompson (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Eric Thompson commented on  PUP-3978 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
  Re: Change how block is passed to avoid confusion with missing optional parameters  
 
 
 
 
 
 
 
 
 
 
verified on windows2012r2-ruby64 at SHA: e46fb00 
 
 
 
 
 
 
Administrator@o6b2aha4d0vaw56 /usr/lib/ruby/site_ruby/2.1.0/puppet/functions 
 
 
 
 
$ cmd /c puppet apply -e 'test(3) |$x| {notice(should be second arg: $x)}' 
 
 
 
 
passed a (first arg): 3 
 
 
 
 
passed b (optional arg): 4 
 
 
 
 
Notice: Scope(Class[main]): should be second arg: 4 
 
 
 
 
Notice: Compiled catalog for o6b2aha4d0vaw56.delivery.puppetlabs.net in environment production in 0.45 seconds 
 
 
 
 
Notice: Applied catalog in 0.02 seconds 
 
 
 
 
 
 
 
 
 
Administrator@o6b2aha4d0vaw56 /usr/lib/ruby/site_ruby/2.1.0/puppet/functions 
 
 
 
 
$ cmd /c puppet apply -e 'test(3, 2345234634563457) |$x| {notice(should be second arg: $x)}' 

Jira (PUP-3978) Change how block is passed to avoid confusion with missing optional parameters

2015-02-13 Thread Eric Thompson (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Eric Thompson updated an issue 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 Puppet /  PUP-3978 
 
 
 
  Change how block is passed to avoid confusion with missing optional parameters  
 
 
 
 
 
 
 
 
 

Change By:
 
 Eric Thompson 
 
 
 

QA Contact:
 
 EricThompson 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-3978) Change how block is passed to avoid confusion with missing optional parameters

2015-02-13 Thread Eric Thompson (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Eric Thompson updated an issue 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 Puppet /  PUP-3978 
 
 
 
  Change how block is passed to avoid confusion with missing optional parameters  
 
 
 
 
 
 
 
 
 

Change By:
 
 Eric Thompson 
 
 
 

QA Status:
 
 Reviewed 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-3978) Change how block is passed to avoid confusion with missing optional parameters

2015-02-12 Thread Eric Thompson (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Eric Thompson commented on  PUP-3978 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
  Re: Change how block is passed to avoid confusion with missing optional parameters  
 
 
 
 
 
 
 
 
 
 
do i need a dispatcher when using blocks? if i don't use a dispatcher and i pass the right amount of args, even if one is optional, i get: 
 
 
 
 
 
 
root@i4f68nhtgsnhw0n:/usr/local/lib/site_ruby/1.9.1/puppet/functions# puppet apply -e 'test(6, 314159) |$x| {$x=42}' 
 
 
 
 
Error: Evaluation Error: Error while evaluating a Function Call, function 'test' called with mis-matched arguments 
 
 
 
 
expected: 
 
 
 
 
  test(Any a, Any b, Any block?) - arg count {2,3} 
 
 
 
 
actual: 
 
 
 
 
  test(Integer, Integer, Callable[Any]) - arg count {3} at line 1:1 on node i4f68nhtgsnhw0n.delivery.puppetlabs.net 
 
 
 
 
Error: Evaluation Error: Error while evaluating a Function Call, function 'test' called with mis-matched arguments 
 
 
 
 
expected: 
 
 
 
 
  test(Any a, Any b, Any block?) - arg count {2,3} 
 
 
 
 

Jira (PUP-3978) Change how block is passed to avoid confusion with missing optional parameters

2015-02-12 Thread Eric Thompson (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Eric Thompson assigned an issue to Unassigned 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 Puppet /  PUP-3978 
 
 
 
  Change how block is passed to avoid confusion with missing optional parameters  
 
 
 
 
 
 
 
 
 

Change By:
 
 Eric Thompson 
 
 
 

Assignee:
 
 EricThompson 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-3978) Change how block is passed to avoid confusion with missing optional parameters

2015-02-12 Thread Eric Thompson (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Eric Thompson updated an issue 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 Puppet /  PUP-3978 
 
 
 
  Change how block is passed to avoid confusion with missing optional parameters  
 
 
 
 
 
 
 
 
 

Change By:
 
 Eric Thompson 
 
 
 

Comment:
 
 doineedadispatcherwhenusingblocks?ifidon'tuseadispatcherandipasstherightamountofargs,evenifoneisoptional,iget:{code}root@i4f68nhtgsnhw0n:/usr/local/lib/site_ruby/1.9.1/puppet/functions#puppetapply-e'test(6,314159)|$x|{$x=42}'Error:EvaluationError:ErrorwhileevaluatingaFunctionCall,function'test'calledwithmis-matchedargumentsexpected:test(Anya,Anyb,Anyblock?)-argcount{2,3}actual:test(Integer,Integer,Callable[Any])-argcount{3}atline1:1onnodei4f68nhtgsnhw0n.delivery.puppetlabs.netError:EvaluationError:ErrorwhileevaluatingaFunctionCall,function'test'calledwithmis-matchedargumentsexpected:test(Anya,Anyb,Anyblock?)-argcount{2,3}actual:test(Integer,Integer,Callable[Any])-argcount{3}atline1:1onnodei4f68nhtgsnhw0n.delivery.puppetlabs.net{code}ifiuseadispatcheritworkswithtwoargsplusthecodeblock,butitusesthedefaultvalueandmismatchedargsifipassoneargumentplusthecodeblock:{code}root@i4f68nhtgsnhw0n:/usr/local/lib/site_ruby/1.9.1/puppet/functions#cattest.rbPuppet::Functions.create_function('test')dodispatch:testdoparam'Integer',:aparam'Integer',:brequired_block_paramenddeftest(a,b=4,block)putspasseda(firstarg):#{a}putspassedb(optionalarg):#{b}blockendendroot@i4f68nhtgsnhw0n:/usr/local/lib/site_ruby/1.9.1/puppet/functions#puppetapply-e'test(6,9)|$x|{$x=42}'passeda(firstarg):6passedb(optionalarg):4Notice:Compiledcatalogfori4f68nhtgsnhw0n.delivery.puppetlabs.netinenvironmentproductionin0.37secondsNotice:Appliedcatalogin0.04secondsroot@i4f68nhtgsnhw0n:/usr/local/lib/site_ruby/1.9.1/puppet/functions#puppetapply-e'test(6)|$x|{$x=42}'Error:EvaluationError:ErrorwhileevaluatingaFunctionCall,function'test'calledwithmis-matchedargumentsexpected:test(Integera,Integerb,Callableblock)-argcount{3}actual:test(Integer,Callable[Any])-argcount{2}atline1:1onnodei4f68nhtgsnhw0n.delivery.puppetlabs.netError:EvaluationError:ErrorwhileevaluatingaFunctionCall,function'test'calledwithmis-matchedargumentsexpected:test(Integera,Integerb,Callableblock)-argcount{3}actual:test(Integer,Callable[Any])-argcount{2}atline1:1onnodei4f68nhtgsnhw0n.delivery.puppetlabs.net{code} 
 
 
 
 
 
 
 
 
 
 
 
 

 
 Add Comment 
 
 
 
 
 
 
 
 
 
 


 
 

Jira (PUP-3978) Change how block is passed to avoid confusion with missing optional parameters

2015-02-12 Thread Eric Thompson (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Eric Thompson assigned an issue to Eric Thompson 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 Puppet /  PUP-3978 
 
 
 
  Change how block is passed to avoid confusion with missing optional parameters  
 
 
 
 
 
 
 
 
 

Change By:
 
 Eric Thompson 
 
 
 

Assignee:
 
 EricThompson 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-3978) Change how block is passed to avoid confusion with missing optional parameters

2015-02-11 Thread Henrik Lindberg (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Henrik Lindberg updated an issue 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
 Puppet /  PUP-3978 
 
 
 
  Change how block is passed to avoid confusion with missing optional parameters  
 
 
 
 
 
 
 
 
 

Change By:
 
 Henrik Lindberg 
 
 
 

Summary:
 
 Missingvaluesfor Changehowblockispassedtoavoidconfusionwithmissing optionalparameters placesblockatwrongposition 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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-3978) Change how block is passed to avoid confusion with missing optional parameters

2015-02-11 Thread Henrik Lindberg (JIRA)
Title: Message Title
 
 
 
 
 
 
 
 
 
 
  
 
 Henrik Lindberg commented on  PUP-3978 
 
 
 
 
 
 
 
 
 
 


 
 
 
 
 
 
  Re: Change how block is passed to avoid confusion with missing optional parameters  
 
 
 
 
 
 
 
 
 
 
Specification updated. A Puppet function that is called with a Puppet lambda/block now gets that the same way as in Ruby - via a Proc.  
Also, just as in Ruby you call the block with yield, or call it explicitly by sending it call (which requires it to be declared as a block parameter). 
This makes testing simpler ince it is now possible to call a puppet function with a ruby code block. 
 
 
 
 
 
 
 
 
 
 
 
 

 
 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.