Hi Andrew,
thank you for the notice (and thanks to Ken B. for informing me about it).
In my modules I have tons of calls to custom functions in the *arguments* 
of my classes.
Things like:

class apache (
  $my_class            = params_lookup( 'my_class' ),
  $source              = params_lookup( 'source' ),
  $source_dir          = params_lookup( 'source_dir' ),
[...]

that, I guess, should be something like 

class apache (
  $my_class            = params_lookup( [ 'my_class' ] ),
  $source              = params_lookup( [ 'source' ] ),
  $source_dir          = params_lookup( [ 'source_dir' ]),
[...]
Now, my question is:
you wrote that this "conversion" from string to array is needed when 
calling custom functions in templates or other functions, but not in Puppet 
DSL.
Is the conversion required  also for the class/define arguments list (which 
might be considered somehow a border case)?

Any info is welcomed.

Best regards
Alessandro Franceschi
Example42.com


On Friday, September 14, 2012 8:22:59 PM UTC+2, Andy Parker wrote:
>
> This is a heads up to anyone who has written code that calls custom 
> functions. We are making a change in Puppet 3.0 that will make the 
> calls reject incorrect calls (see bug #15756). Calling functions from 
> ruby code (either other functions or erb templates) was always 
> supposed to be done by placing all of the arguments in an array and 
> passing the array to the method call. This was using done by 
> surrounding the arguments with square brackets. 
>
>     function_template( [ 'my_template.erb' ] ) 
>
> Some, but not all, functions had been written in a way that would by 
> chance work when this was not done. The template function is one such 
> example. It would work if you were running on a 1.8 ruby if it was 
> called as: 
>
>     function_template( 'my_template.erb' ) 
>
> However, if you tried running on a 1.9 ruby that function call would 
> fail with an error about not having a method named 'collect' on a 
> String, which is caused by a change in the String class in ruby. To 
> prevent these kinds of errors in the future, Puppet 3.0 is going to 
> check that the arguments are passed in an array and fail if they are 
> not. 
>
> I did a quick check across the code available in the Forge and it 
> doesn't look like it was too common that this was done wrong, but you 
> might want to check through your code for calls of functions where the 
> arguments are not being passed in an array, and change them to use an 
> array. 
>
> NOTE: If you have only ever called custom functions from inside the 
> Puppet Language, then you don't need to worry about anything, this 
> does not apply to that. 
>
> Thanks, 
> Andrew Parker 
> Puppet Team Lead 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/Fbji-OwL4I4J.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to