Sha256: ae6f2dc42f6143eaeadb7e19322f9d3c170b89c6d44031f6a765ffbfef47b9d4

Contents?: true

Size: 579 Bytes

Versions: 43

Compression:

Stored size: 579 Bytes

Contents

# frozen_string_literal: true

# Write a string to a file.
Puppet::Functions.create_function(:'file::write') do
  # @param filename Absolute path.
  # @param content File content to write.
  # @example Write a file to disk
  #   file::write('C:/Users/me/report', $apply_result.first.report)
  dispatch :write do
    required_param 'String', :filename
    required_param 'String', :content
    return_type 'Undef'
  end

  def write(filename, content)
    Puppet.lookup(:bolt_executor) {}&.report_function_call(self.class.name)
    File.write(filename, content)
    nil
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
bolt-2.9.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-2.8.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-2.7.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-2.6.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-2.5.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-2.4.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-2.3.1 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-2.3.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-2.2.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-2.1.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-2.0.1 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-2.0.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-1.49.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-1.48.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-1.47.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-1.45.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-1.44.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-1.43.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-1.42.0 bolt-modules/file/lib/puppet/functions/file/write.rb
bolt-1.41.0 bolt-modules/file/lib/puppet/functions/file/write.rb