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

Version Path
puppet-2.6.12 lib/puppet/parser/functions/file.rb
puppet-2.7.5 lib/puppet/parser/functions/file.rb
puppet-2.6.11 lib/puppet/parser/functions/file.rb
puppet-2.7.4 lib/puppet/parser/functions/file.rb
puppet-2.6.10 lib/puppet/parser/functions/file.rb
puppet-2.7.3 lib/puppet/parser/functions/file.rb
puppet-2.7.1 lib/puppet/parser/functions/file.rb
puppet-2.6.9 lib/puppet/parser/functions/file.rb
puppet-2.6.8 lib/puppet/parser/functions/file.rb
puppet-2.6.7 lib/puppet/parser/functions/file.rb
puppet-2.6.6 lib/puppet/parser/functions/file.rb
puppet-2.6.5 lib/puppet/parser/functions/file.rb
puppet-2.6.4 lib/puppet/parser/functions/file.rb
puppet-2.6.3 lib/puppet/parser/functions/file.rb
puppet-2.6.2 lib/puppet/parser/functions/file.rb
puppet-2.6.1 lib/puppet/parser/functions/file.rb