On Sun, 2009-02-22 at 22:10 -0800, Luke Kanies wrote: > Looks great, with one question: > > Shouldn't the :recurse parameter set :recurselimit if it is set to a > number? Something like: > > newparam(:recurse) do > ... > munge do |value| > value = super # I *think* this works > if value.is_a?(Fixnum) > value = true > resource[:recurselimit] = value > end > end
Yes, you're right, but in fact I retained the original logic, because I wasn't sure it was possible set another parameter value from a munge block of another parameter. It seems to be possible from your snippet. So what I did in fact was to keep the original behavior, and use recurselimit only when it is set. I also added a failure if recurse is a number and recurselimit is set. Another question, is it possible to fail in a munge block, or should I use validate for this? I mean the following: file { "/tmp/a": recurse => 12, recurselimit => 13 } If I understood correctly, first the recurse block will be called, it will put recurselimit to 12. Then the recurselimit block will be called. Is it possible to fail there with an error saying "Impossible to have recurse with a number and recurselimit set at the same time". And same question for the reverse situation (where the recurselimit parameter is set before the recurse one)? > I assume this logic is in there somewhere, but I can't seem to find it. Yes, it is mixed in Puppet::FileServing::Fileset.recurse?, where I kept the original code and added the recurselimit part. But I think you're right, it is better to move the recurse limit always to recurselimit as it makes the code easier to read/understand and the intent becomes more obvious (instead of having the Fileset.recurse parameter which can take several different values). I'll fix this tonight. Thanks, > On Feb 22, 2009, at 2:02 PM, Brice Figureau wrote: > [patch ellided] -- Brice Figureau My Blog: http://www.masterzen.fr/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~---