From e550ccb03852ffe86c3318bb6fe06886e4faba19 Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Mon, 19 Oct 2020 14:14:47 +0200
Subject: [PATCH] wrap database save call in try/catch block, to mitigate
 metadata sync failure

---
 bin/update-metadata.in | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bin/update-metadata.in b/bin/update-metadata.in
index 2fc80a1..59979b3 100755
--- a/bin/update-metadata.in
+++ b/bin/update-metadata.in
@@ -125,7 +125,12 @@ foreach my $id (keys %{$configuration->{federations}}) {
                 $entity->contacts(@contacts);
             }
             $entity->federations($id);
-            $entity->save();
+            eval {
+                $entity->save();
+            };
+            if ($EVAL_ERROR) {
+                warn "error while saving entity $entry->{entityid}: $EVAL_ERROR";
+            }
         }
 
     }
-- 
GitLab