Em quarta-feira, 12 de fevereiro de 2014 11h21min30s UTC-2, kashif escreveu:
>
> I have written a small custom function to replace '.' to '_' of all
> element of an array and return an converted array.
>
> module Puppet::Parser::Functions
> newfunction(:convert_vo, :type => :rvalue, :doc => <<-'ENDOFDOC'
> This function takes an array of vo and replace '.' with '_' and return an
> converted array
> ENDOFDOC
> ) do |arguments|
>
> require 'rubygems'
> vo_list = arguments.clone
> unless vo_list.is_a?(Array)
> raise(Puppet::ParseError, 'convert_vo requires an array')
> end
> converted_vo = Array.new()
> vo_list.each do |vo|
> converted_vo.push(vo.gsub(/\./, '_'))
> end
> return converted_vo
> end
> end
>
> I am calling it like this from init.p
>
> $vo = ['dteam', 'vo.southgrid.ac.uk']
> $converted_vo = convert_vo($vo)
>
>
> Puppet run on client machine fails with this error
>
> Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
> private method `gsub' called for ["dteam", "vo.southgrid.ac.uk"]:Array at
> /etc/puppet/modules/voms_client/manifests/init.pp
>
>
> I ran this script on client and server machines seperately and it worked
> perfectly. I am not sure that what I am missing?
>
> Thanks
> Kashif
>
Did you do this?
In order to make your custom functions available to your puppetmaster:
- Place the function in a
MODULEPATH/MODULENAME/lib/puppet/parser/functions directory.
- Enable pluginsync in /etc/puppet/puppet.conf on client and server.
[main]
pluginsync = true
factpath = $vardir/lib/facter
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/28a1cf6a-22e8-4236-962d-ff27f113edb2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.