This is an automated email from the ASF dual-hosted git repository.

sebb 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 b7c675df Ensure SVN errors are detected
b7c675df is described below

commit b7c675dff8666e6bb7a6eeb23072e6033fb6d787
Author: Sebb <[email protected]>
AuthorDate: Mon Jan 1 14:16:06 2024 +0000

    Ensure SVN errors are detected
    
    Allow for missing previous agenda
    [skip ci]
---
 www/board/agenda/routes.rb | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

diff --git a/www/board/agenda/routes.rb b/www/board/agenda/routes.rb
index 0e2dcf2e..9b4ed054 100755
--- a/www/board/agenda/routes.rb
+++ b/www/board/agenda/routes.rb
@@ -541,10 +541,15 @@ get '/new' do
   @next_month = next_month[/(.*#.*\n)+/] || ''
 
   # get potential actions
-  actions = JSON.parse(Wunderbar::JsonBuilder.new({}).instance_eval(
-    File.read("#{settings.views}/actions/potential-actions.json.rb"),
-  ).target!, symbolize_names: true)[:actions]
-
+  begin
+    actions = JSON.parse(Wunderbar::JsonBuilder.new({}).instance_eval(
+      File.read("#{settings.views}/actions/potential-actions.json.rb"),
+    ).target!, symbolize_names: true)[:actions]
+  rescue IOError => e
+    Wunderbar.warn "#{e}, could not access previous actions, continuing"
+    actions = nil
+  end
+  
   # Get directors, list of pmcs due to report, and shepherds
   @directors = ASF::Board.directors
   @pmcs = ASF::Board.reporting(@meeting)
@@ -590,19 +595,25 @@ post %r{/(\d\d\d\d-\d\d-\d\d)/} do |date|
 
   Dir.mktmpdir do |dir|
 
-    ASF::SVN.svn('checkout', [boardurl, dir], {depth: 'empty', env: env})
+    ASF::SVN.svn!('checkout', [boardurl, dir], {depth: 'empty', env: env})
 
     agendapath = File.join(dir, agenda)
     File.write agendapath, contents
-    ASF::SVN.svn('add', agendapath)
+    ASF::SVN.svn!('add', agendapath)
 
     currentpath = File.join(dir, 'current.txt')
-    ASF::SVN.svn('update', currentpath, {env: env})
-
-    File.unlink currentpath
-    File.symlink agenda, currentpath
+    ASF::SVN.svn!('update', currentpath, {env: env})
+
+    if File.exist? currentpath
+      File.unlink currentpath 
+      File.symlink agenda, currentpath
+    else
+      Wunderbar.warn "current.txt link does not exist, creating it"
+      File.symlink agenda, currentpath
+      ASF::SVN.svn!('add', currentpath)
+    end
 
-    ASF::SVN.svn('commit', [agendapath, currentpath], {msg: "Post #{date} 
agenda", env: env})
+    ASF::SVN.svn!('commit', [agendapath, currentpath], {msg: "Post #{date} 
agenda", env: env})
     Agenda.update_cache agenda, agendapath, contents, false
   end
 

Reply via email to