Hello!

I've written custom function split - it's located in modules/common/ 
plugins/puppet/parser/functions/split.rb and contains:
module Puppet::Parser::Functions
   newfunction(:split, :type => :rvalue) do |args|
     str=args[0]
     regex=args[1]
     idx=args[2]
     out=str.split(/#{regex}/)
     if out.is_a? Array
       out[idx]
     else
       ""
     end
   end
end

Now, each time I'm trying to do somewhere in manifests:
include "common"
$var=split("part1->part2","->",0)

I see following error:
err: Could not retrieve catalog: can't convert String into Integer at / 
home/graf0/new-puppet/manifests/test/site.pp:57 on node ubuntu- 
server.hq.local

Any ideas, what I'm doing wrong?

---
Grzegorz Marszałek
[email protected]



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to