This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new b263ca2 update via puppet as an option
b263ca2 is described below
commit b263ca2b244e9718e2de00378efb751169a18ebb
Author: Sam Ruby <[email protected]>
AuthorDate: Wed Jun 7 15:18:36 2017 -0400
update via puppet as an option
---
tools/pubsub.rb | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/tools/pubsub.rb b/tools/pubsub.rb
index d8a6258..38990e9 100644
--- a/tools/pubsub.rb
+++ b/tools/pubsub.rb
@@ -27,6 +27,7 @@ options.remote =
'https://gitbox.apache.org/repos/asf/whimsy.git'
options.local = '/srv/whimsy'
options.pidfile = "/var/run/#{script}.pid"
options.streamURL = 'http://gitpubsub-wip.apache.org:2069/json/*'
+options.puppet = false
# options.streamURL = 'http://svn.apache.org:2069/commits'
optionparser = OptionParser.new do |opts|
@@ -46,6 +47,10 @@ optionparser = OptionParser.new do |opts|
options.daemonize = true
end
+ opts.on ''--puppet', "Use puppet agent to update" do
+ options.puppet = true
+ end
+
opts.on '-s', '--stream', "StreamURL" do |url|
options.streamURL = url
end
@@ -170,13 +175,25 @@ begin
notification = notification_queue.pop
next unless notification['project'] == project
notification_queue.clear
- Dir.chdir(options.local) do
- before = `git log --oneline -1`
- system 'git fetch origin'
- system 'git clean -df'
- system 'git reset --hard origin/master'
- if File.exist? 'Rakefile' and `git log --oneline -1` != before
- system 'rake update'
+
+ if options.puppet
+ # Update using puppet. If puppet fails, it may be due to puppet already
+ # running; in which case it may not have picked up this update. So try
+ # again in 30, 60, 90, and 120 seconds, for a total of five minutes.
+ 4.times do |i|
+ break if system 'puppet agent -t'
+ sleep 30 * (i+1)
+ end
+ else
+ # update git directories in the foreground
+ Dir.chdir(options.local) do
+ before = `git log --oneline -1`
+ system 'git fetch origin'
+ system 'git clean -df'
+ system 'git reset --hard origin/master'
+ if File.exist? 'Rakefile' and `git log --oneline -1` != before
+ system 'rake update'
+ end
end
end
next if mtime != File.mtime(__FILE__)
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].