Anybody have any thoughts on this? On Oct 7, 8:50 am, Nate <nathan.schum...@gmail.com> wrote: > Hi, > > I'm trying create acustomfunctionthat willreturnanarrayof file > paths for the file type source. Instead of defining the followingarrayfor > source for each file type: > > file: { "some_file": > source => [ "puppet:///file/$hostname/path", "puppet:///file/$role/ > $mode/path", "puppet:///file/$role/path", "puppet:///file/common/ > path", ], > ... > > } > > I've created acustomfunctiontoreturnthe generatedarraysimilar > to the following: > > file: { "some_file": > source => find_file(path), > ... > > } > > I'm getting the following message on the client: > > err: Could not retrieve catalog from remote server: Error 400 on > SERVER:Function'find_file' does notreturna value at /etc/puppet/ > manifests/class/sudo.pp:12 on node tnfs01 > > Thefunctionis located at /var/lib/puppet/lib/puppet/parser/functions/ > find_file.rb. > > Function: > > module Puppet::Parser::Functions > newfunction(:find_file, :type => :rvalue) do |args| > filename = args[0] > hostname = lookupvar('hostname') > role = lookupvar('role') > mode = lookupvar('mode') > sources =Array.new > sources << "puppet:///files/#{hostname}/#{filename}" > sources << "puppet:///files/#{role}/#{mode}/#{filename}" > sources << "puppet:///files/#{role}/#{filename}" > sources << "puppet:///files/common/#{filename}" > returnsources > end > end > > Not sure what I'm doing wrong here. Any help would be greatly > appreciated. Also, if there's already a built-in way to do this in > Puppet I'd gladly ditch thecustomfunction, although I'd still like > to figure out the problem for future reference. > > Thanks, > > Nate
-- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.