summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network/client
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-05-18 23:45:30 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-05-18 23:45:30 +0000
commit6f83d4daab56385df9a1625cf8ffc64b6a8958f7 (patch)
tree96f5d3eb98f0e61396e02256b2071170fb65c88e /lib/puppet/network/client
parent7d1f7606c38ad7b32651e8bc98e2258feda99294 (diff)
downloadpuppet-6f83d4daab56385df9a1625cf8ffc64b6a8958f7.tar.gz
puppet-6f83d4daab56385df9a1625cf8ffc64b6a8958f7.tar.xz
puppet-6f83d4daab56385df9a1625cf8ffc64b6a8958f7.zip
Fixing #501 -- there is now a splay option, disabled by default and when running under --test
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2528 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/network/client')
-rw-r--r--lib/puppet/network/client/master.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/puppet/network/client/master.rb b/lib/puppet/network/client/master.rb
index 7eb009b2d..2b9490539 100644
--- a/lib/puppet/network/client/master.rb
+++ b/lib/puppet/network/client/master.rb
@@ -293,6 +293,7 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
# The code that actually runs the configuration.
def run(tags = nil, ignoreschedules = false)
got_lock = false
+ splay
Puppet::Util.sync(:puppetrun).synchronize(Sync::EX) do
if !lockfile.lock
Puppet.notice "Lock file %s exists; skipping configuration run" %
@@ -663,6 +664,22 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
@lockfile
end
+
+ # Sleep when splay is enabled; else just return.
+ def splay
+ return unless Puppet[:splay]
+
+ limit = Integer(Puppet[:splaylimit])
+
+ # Pick a splay time and then cache it.
+ unless time = Puppet::Util::Storage.cache(:configuration)[:splay_time]
+ time = rand(limit)
+ Puppet::Util::Storage.cache(:configuration)[:splay_time] = time
+ end
+
+ Puppet.info "Sleeping for %s seconds (splay is enabled)" % time
+ sleep(time)
+ end
end
# $Id$