diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-08-24 11:55:57 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-08-24 11:55:57 -0400 |
commit | 2f20ca99374b5bc99881911f7c19bf9892bd9c29 (patch) | |
tree | da68c289408feb5bc706468eed37e01352a06e27 | |
parent | 950ed0aa06a1539691af353a8392d252c926b3d8 (diff) | |
download | grokmirror-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-x | grokmirror/fsck.py | 11 |
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 |