Sha256: 5dd71fe5f0def3067658aec0d84a61d19623447d3d396f3cb6cbb5b7df361922
Contents?: true
Size: 659 Bytes
Versions: 36
Compression:
Stored size: 659 Bytes
Contents
# Returns the contents of a file Puppet::Parser::Functions::newfunction( :file, :type => :rvalue, :doc => "Return the contents of a file. Multiple files can be passed, and the first file that exists will be read in.") do |vals| ret = nil vals.each do |file| unless file =~ /^#{File::SEPARATOR}/ raise Puppet::ParseError, "Files must be fully qualified" end if FileTest.exists?(file) ret = File.read(file) break end end if ret ret else raise Puppet::ParseError, "Could not find any files from #{vals.join(", ")}" end end
Version data entries
36 entries across 36 versions & 2 rubygems