aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-08-24 11:55:57 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-08-24 11:55:57 -0400
commit2f20ca99374b5bc99881911f7c19bf9892bd9c29 (patch)
treeda68c289408feb5bc706468eed37e01352a06e27
parent950ed0aa06a1539691af353a8392d252c926b3d8 (diff)
downloadgrokmirror-2f20ca99374b5bc99881911f7c19bf9892bd9c29.tar.gz
Catch problems with alternates early on
If the alternates repo is gone, catch this problem early on and request reclone. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rwxr-xr-xgrokmirror/fsck.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/grokmirror/fsck.py b/grokmirror/fsck.py
index 408120d..8678649 100755
--- a/grokmirror/fsck.py
+++ b/grokmirror/fsck.py
@@ -57,6 +57,10 @@ def check_reclone_error(fullpath, config, errors):
if reclone is None:
return
+ set_repo_reclone(fullpath, reclone)
+
+
+def set_repo_reclone(fullpath, reason):
rfile = os.path.join(fullpath, 'grokmirror.reclone')
# Have we already requested a reclone?
if os.path.exists(rfile):
@@ -64,7 +68,7 @@ def check_reclone_error(fullpath, config, errors):
return
with open(rfile, 'w') as rfh:
- rfh.write('Requested by grok-fsck due to error: %s' % reclone)
+ rfh.write('Requested by grok-fsck due to error: %s' % reason)
def run_git_prune(fullpath, config):
@@ -616,6 +620,11 @@ def fsck_mirror(config, force=False, repack_only=False, conn_only=False,
logger.info(' ---: %s analyzed, %s queued, %s total', analyzed, len(to_process), len(status))
obst_roots[obstrepo] = grokmirror.get_repo_roots(obstrepo, force=True)
+ elif not os.path.isdir(altdir):
+ logger.info(' reclone: %s (alternates repo gone)', gitdir)
+ set_repo_reclone(fullpath, 'Alternates repository gone')
+ continue
+
elif altdir.find(obstdir) != 0:
# We have an alternates repo, but it's not an objstore repo
# Probably left over from grokmirror-1.x