Sha256: d4b02cc384ba9e5f3123e865c57dad518ca0fcef855d7f20b4be303343364423

Contents?: true

Size: 640 Bytes

Versions: 18

Compression:

Stored size: 640 Bytes

Contents

# Returns the contents of a file

Puppet::Parser::Functions::newfunction(
  :file, :arity => -2, :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 Puppet::FileSystem.exist?(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

18 entries across 18 versions & 1 rubygems

Version Path
puppet-3.6.2 lib/puppet/parser/functions/file.rb
puppet-3.6.2-x86-mingw32 lib/puppet/parser/functions/file.rb
puppet-3.6.1 lib/puppet/parser/functions/file.rb
puppet-3.6.1-x86-mingw32 lib/puppet/parser/functions/file.rb
puppet-3.6.0 lib/puppet/parser/functions/file.rb
puppet-3.6.0-x86-mingw32 lib/puppet/parser/functions/file.rb
puppet-3.6.0.rc1 lib/puppet/parser/functions/file.rb
puppet-3.6.0.rc1-x86-mingw32 lib/puppet/parser/functions/file.rb
puppet-3.5.1 lib/puppet/parser/functions/file.rb
puppet-3.5.1-x86-mingw32 lib/puppet/parser/functions/file.rb
puppet-3.5.1.rc1 lib/puppet/parser/functions/file.rb
puppet-3.5.1.rc1-x86-mingw32 lib/puppet/parser/functions/file.rb
puppet-3.5.0.rc3 lib/puppet/parser/functions/file.rb
puppet-3.5.0.rc3-x86-mingw32 lib/puppet/parser/functions/file.rb
puppet-3.5.0.rc2 lib/puppet/parser/functions/file.rb
puppet-3.5.0.rc2-x86-mingw32 lib/puppet/parser/functions/file.rb
puppet-3.5.0.rc1 lib/puppet/parser/functions/file.rb
puppet-3.5.0.rc1-x86-mingw32 lib/puppet/parser/functions/file.rb