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

-- 
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CADXPHmtM8y%3DmJevuyVo_QMpfDcZDpZL4nit9GgyWDSwcY-Wg1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to