Module: Puppet::Util::Splayer
- Included in:
- Agent, Application::Apply
- Defined in:
- lib/puppet/util/splayer.rb
Overview
Handle splay options (sleeping for a random interval before executing)
Instance Method Summary collapse
-
#splay(do_splay = Puppet[:splay]) ⇒ Object
Sleep when splay is enabled; else just return.
-
#splayed? ⇒ Boolean
Have we splayed already?.
Instance Method Details
#splay(do_splay = Puppet[:splay]) ⇒ Object
Sleep when splay is enabled; else just return.
11 12 13 14 15 16 17 18 19 |
# File 'lib/puppet/util/splayer.rb', line 11 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 |
#splayed? ⇒ Boolean
Have we splayed already?
6 7 8 |
# File 'lib/puppet/util/splayer.rb', line 6 def splayed? !!@splayed end |