Sha256: 027973bb4d6b314122e39c173709e8117e9a73d50ccd0a0c0f58bb64ee28f0d6

Contents?: true

Size: 513 Bytes

Versions: 32

Compression:

Stored size: 513 Bytes

Contents

# frozen_string_literal: true

# Handle splay options (sleeping for a random interval before executing)
module Puppet::Util::Splayer
  # Have we splayed already?
  def splayed?
    !!@splayed
  end

  # Sleep when splay is enabled; else just return.
  def splay(do_splay = Puppet[:splay])
    return unless do_splay
    return if splayed?

    time = rand(Puppet[:splaylimit] + 1)
    Puppet.info _("Sleeping for %{time} seconds (splay is enabled)") % { time: time }
    sleep(time)
    @splayed = true
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
puppet-8.10.0 lib/puppet/util/splayer.rb
puppet-8.10.0-x86-mingw32 lib/puppet/util/splayer.rb
puppet-8.10.0-x64-mingw32 lib/puppet/util/splayer.rb
puppet-8.10.0-universal-darwin lib/puppet/util/splayer.rb
puppet-8.9.0 lib/puppet/util/splayer.rb
puppet-8.9.0-x86-mingw32 lib/puppet/util/splayer.rb
puppet-8.9.0-x64-mingw32 lib/puppet/util/splayer.rb
puppet-8.9.0-universal-darwin lib/puppet/util/splayer.rb
puppet-8.8.1 lib/puppet/util/splayer.rb
puppet-8.8.1-x86-mingw32 lib/puppet/util/splayer.rb
puppet-8.8.1-x64-mingw32 lib/puppet/util/splayer.rb
puppet-8.8.1-universal-darwin lib/puppet/util/splayer.rb
puppet-8.7.0 lib/puppet/util/splayer.rb
puppet-8.7.0-x86-mingw32 lib/puppet/util/splayer.rb
puppet-8.7.0-x64-mingw32 lib/puppet/util/splayer.rb
puppet-8.7.0-universal-darwin lib/puppet/util/splayer.rb
puppet-8.6.0 lib/puppet/util/splayer.rb
puppet-8.6.0-x86-mingw32 lib/puppet/util/splayer.rb
puppet-8.6.0-x64-mingw32 lib/puppet/util/splayer.rb
puppet-8.6.0-universal-darwin lib/puppet/util/splayer.rb