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
graf0@post.pl
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Oh, and I''m using puppet 0.24.6. Wiadomość napisana w dniu 2009-01-03, o godz. 00:34, przez Grzegorz Marszałek:> > 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 > graf0@post.pl > > > > >--- Grzegorz Marszałek alias Ojciec Dyrektor ;) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Ok, sorry for trouble - I misspelled filename. Now it works perfectly :) Wiadomość napisana w dniu 2009-01-03, o godz. 00:44, przez Grzegorz Marszałek:> > Oh, and I''m using puppet 0.24.6. > > Wiadomość napisana w dniu 2009-01-03, o godz. 00:34, przez Grzegorz > Marszałek: > >> >> 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 >> graf0@post.pl >> >> >> >>> > > --- > Grzegorz Marszałek > alias Ojciec Dyrektor ;) > > > > > >--- Grzegorz Marszałek alias Ojciec Dyrektor ;) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---