you are missing the type in the function.. For example: newfunction(:func, :type =>rvalue) do...
Cheers, Ohad On 12/9/08, Jeff <[EMAIL PROTECTED]> wrote: > > Greetings, puppeteers. As per yesterday's discussion on if a file > exists on the pupper master, I decided to write a custom function. I'm > prolific in a lot of languages unfortunately, ruby isn't one of them. > Here's my function: > > module Puppet::Parser::Functions > > newfunction(:file_exists) do |args| > filename = args[0] > return File.exists?(filename) > end > > end > > > That seems straightforward but it barfs with the following error: > > err: Could not retrieve configuration: Function 'file_exists' does not > return a value > > Seriously? The exists instance method is a boolean. What do you mean > it doesn't return a value? > > I humored it with this version: > > module Puppet::Parser::Functions > > newfunction(:file_exists) do |args| > filename = args[0] > if File.exists?(filename) > return true > else > return false > end > end > > end > > But the results were identical. Any thoughts for a ruby noob. > > Jeff > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
