Puppet Function: file_exists

Defined in:
lib/puppet/parser/functions/file_exists.rb
Function type:
Ruby 3.x API

Overview

file_exists()Any

Returns true if the file exists.

Returns:

  • (Any)


8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/puppet/parser/functions/file_exists.rb', line 8

newfunction(:file_exists, :type => :rvalue, :doc => <<-EOS
Returns true if the file exists.
  EOS
) do |args|
  raise(Puppet::ParseError, "file_exists(): Wrong number of arguments " +
    "given (#{args.size} for 1)") if args.size != 1
  if File.exists?(args[0])
    return true
  else
   return false
  end
end