Sha256: 5b3d88e89ed98f0a6cc510f6753fd3c557bdb309e4575079ead192a5ead3e198

Contents?: true

Size: 967 Bytes

Versions: 22

Compression:

Stored size: 967 Bytes

Contents

# frozen_string_literal: true

# Define a block where default logging is suppressed.
#
# Messages for actions within this block will be logged at `info` level instead
# of `notice`, so they will not be seen normally but # will still be present
# when `verbose` logging is requested.
Puppet::Functions.create_function(:without_default_logging) do
  # @param block The block where action logging is suppressed.
  # @return [Undef]
  # @example Suppress default logging for a series of functions
  #   without_default_logging() || {
  #     notice("Deploying on ${nodes}")
  #     get_targets($nodes).each |$node| {
  #       run_task(deploy, $node)
  #     }
  #   }
  dispatch :without_default_logging do
    block_param 'Callable[0, 0]', :block
  end

  def without_default_logging
    executor = Puppet.lookup(:bolt_executor) { nil }
    executor.report_function_call('without_default_logging')

    executor.without_default_logging do
      yield
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
bolt-1.12.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-1.11.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-1.10.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-1.9.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-1.8.1 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-1.8.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-1.7.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-1.6.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-1.5.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-1.4.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-1.3.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-1.2.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-1.1.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-1.0.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-0.25.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-0.24.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-0.23.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-0.22.0 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-0.21.8 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
bolt-0.21.7 bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb