Sha256: 89823938ae974c580b66b14c4e8371c7057e2fcb46c147a2d88116e2bfbcd841

Contents?: true

Size: 512 Bytes

Versions: 20

Compression:

Stored size: 512 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

20 entries across 20 versions & 1 rubygems

Version Path
puppet-8.3.0 lib/puppet/util/splayer.rb
puppet-8.3.0-x86-mingw32 lib/puppet/util/splayer.rb
puppet-8.3.0-x64-mingw32 lib/puppet/util/splayer.rb
puppet-8.3.0-universal-darwin lib/puppet/util/splayer.rb
puppet-8.3.1 lib/puppet/util/splayer.rb
puppet-8.3.1-x86-mingw32 lib/puppet/util/splayer.rb
puppet-8.3.1-x64-mingw32 lib/puppet/util/splayer.rb
puppet-8.3.1-universal-darwin lib/puppet/util/splayer.rb
puppet-8.2.0 lib/puppet/util/splayer.rb
puppet-8.2.0-x86-mingw32 lib/puppet/util/splayer.rb
puppet-8.2.0-x64-mingw32 lib/puppet/util/splayer.rb
puppet-8.2.0-universal-darwin lib/puppet/util/splayer.rb
puppet-8.1.0 lib/puppet/util/splayer.rb
puppet-8.1.0-x86-mingw32 lib/puppet/util/splayer.rb
puppet-8.1.0-x64-mingw32 lib/puppet/util/splayer.rb
puppet-8.1.0-universal-darwin lib/puppet/util/splayer.rb
puppet-8.0.1 lib/puppet/util/splayer.rb
puppet-8.0.1-x86-mingw32 lib/puppet/util/splayer.rb
puppet-8.0.1-x64-mingw32 lib/puppet/util/splayer.rb
puppet-8.0.1-universal-darwin lib/puppet/util/splayer.rb