Sha256: 2a348d3cf7266233ed74f6abc86f19bc27a2fa480a9848660cc1c02897e8f6c6

Contents?: true

Size: 918 Bytes

Versions: 26

Compression:

Stored size: 918 Bytes

Contents

# frozen_string_literal: true

# Output a message for the user.
#
# This will print a message to stdout when using the human output format,
# and print to stderr when using the json output format
#
# **NOTE:** Not available in apply block
Puppet::Functions.create_function(:'out::message') do
  # Output a message.
  # @param message The message to output.
  # @example Print a message
  #   out::message('Something went wrong')
  dispatch :output_message do
    param 'String', :message
    return_type 'Undef'
  end

  def output_message(message)
    unless Puppet[:tasks]
      raise Puppet::ParseErrorWithIssue
        .from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'out::message')
    end

    executor = Puppet.lookup(:bolt_executor)
    executor.report_function_call(self.class.name)
    executor.publish_event(type: :message, message: message)

    nil
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
bolt-1.49.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.48.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.47.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.45.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.44.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.43.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.42.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.41.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.40.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.39.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.38.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.37.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.36.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.35.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.34.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.33.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.32.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.31.1 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.31.0 bolt-modules/out/lib/puppet/functions/out/message.rb
bolt-1.30.1 bolt-modules/out/lib/puppet/functions/out/message.rb