Sha256: 5a14a582efc998af5a2b1d6ff1f34f49bd952939021a8c06457591646bd39854

Contents?: true

Size: 478 Bytes

Versions: 17

Compression:

Stored size: 478 Bytes

Contents

# frozen_string_literal: true

# Repeat the block until it returns a truthy value. Returns the value.
Puppet::Functions.create_function(:'ctrl::do_until') do
  # @example Run a task until it succeeds
  #   ctrl::do_until() || {
  #     run_task('test', $target, _catch_errors => true).ok?
  #   }
  dispatch :do_until do
    block_param
  end

  def do_until
    Puppet.lookup(:bolt_executor) {}&.report_function_call(self.class.name)
    until (x = yield); end
    x
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
bolt-1.34.0 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.33.0 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.32.0 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.31.1 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.31.0 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.30.1 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.30.0 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.29.1 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.29.0 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.28.0 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.27.1 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.27.0 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.26.0 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.25.0 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.24.0 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.23.0 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
bolt-1.22.0 bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb