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

Version Path
puppet-parse-0.1.4 lib/vendor/puppet/parser/functions/file.rb
puppet-parse-0.1.3 lib/vendor/puppet/parser/functions/file.rb
puppet-parse-0.1.2 lib/vendor/puppet/parser/functions/file.rb
puppet-parse-0.1.1 lib/vendor/puppet/parser/functions/file.rb
puppet-2.7.26 lib/puppet/parser/functions/file.rb
puppet-2.7.25 lib/puppet/parser/functions/file.rb
puppet-2.7.24 lib/puppet/parser/functions/file.rb
puppet-2.7.23 lib/puppet/parser/functions/file.rb
puppet-2.7.22 lib/puppet/parser/functions/file.rb
puppet-parse-0.1.0 lib/vendor/puppet/parser/functions/file.rb
puppet-parse-0.0.6 lib/vendor/puppet/parser/functions/file.rb
puppet-2.7.21 lib/puppet/parser/functions/file.rb
puppet-parse-0.0.5 lib/vendor/puppet/parser/functions/file.rb
puppet-parse-0.0.4 lib/vendor/puppet/parser/functions/file.rb
puppet-parse-0.0.2 lib/vendor/puppet/parser/functions/file.rb
puppet-2.7.20 lib/puppet/parser/functions/file.rb
puppet-2.7.20.rc1 lib/puppet/parser/functions/file.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/puppet-2.7.18/lib/puppet/parser/functions/file.rb
puppet-2.7.19 lib/puppet/parser/functions/file.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/puppet-2.7.18/lib/puppet/parser/functions/file.rb