Sha256: b85bb9d3a3f57f1adbc74839ae983bc29280500483545a2b8fb5cd100f5b901e
Contents?: true
Size: 663 Bytes
Versions: 26
Compression:
Stored size: 663 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 Puppet::Util.absolute_path?(file) 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
26 entries across 26 versions & 3 rubygems