Sha256: 3aecf41b55049be72e0f438847126ce944fadcc4afb3dd905d69d407d7499f0e

Contents?: true

Size: 1.1 KB

Versions: 22

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require 'bolt/util/format'

# Output a message for the user when running in verbose mode.
#
# This will print a message to stdout when using the human output format,
# and print to stderr when using the json output format. Messages are
# also logged at the `debug` level. For more information about logs, see
# [Logs](logs.md).
#
# > **Note:** Not available in apply block
Puppet::Functions.create_function(:'out::verbose') do
  # @param message The message to output.
  # @example Print a message
  #   out::verbose('Something went wrong')
  dispatch :output_verbose do
    param 'Any', :message
    return_type 'Undef'
  end

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

    Puppet.lookup(:bolt_executor).tap do |executor|
      executor.report_function_call(self.class.name)
      executor.publish_event(type: :verbose, message: Bolt::Util::Format.stringify(message), level: :debug)
    end

    nil
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
bolt-3.29.0 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.28.0 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.27.4 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.27.2 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.27.1 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.26.2 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.26.1 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.25.0 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.24.0 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.23.1 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.23.0 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.22.1 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.22.0 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.21.0 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.20.0 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.19.0 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.18.0 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.17.0 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.16.1 bolt-modules/out/lib/puppet/functions/out/verbose.rb
bolt-3.16.0 bolt-modules/out/lib/puppet/functions/out/verbose.rb