X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Froles%2Ffiles%2Fstatic-mirroring%2Fstatic-master-run;h=c85e984470ee7f4c436d87c3ca417a8152c7e260;hb=4fabceb478fa5afa63b5df7ccac587724401552c;hp=6ebe2be8129d90f0a0f7ef3a99341ac37b623655;hpb=cf710a2f5fa536f601433238b3e6de63ccaa288b;p=mirror%2Fdsa-puppet.git diff --git a/modules/roles/files/static-mirroring/static-master-run b/modules/roles/files/static-mirroring/static-master-run index 6ebe2be81..c85e98447 100755 --- a/modules/roles/files/static-mirroring/static-master-run +++ b/modules/roles/files/static-mirroring/static-master-run @@ -9,8 +9,9 @@ import sys import tempfile import time -base='/home/staticsync/static-master' +base="/srv/static.debian.org" serialname = '.serial' +had_warnings = False clients = [] with open('/etc/static-clients.conf') as f: @@ -100,11 +101,24 @@ def callout(component, serial): log("Stage 1 done.") cnt = count_statuses(status) - if 'failed' in cnt > 0: - log("Some clients failed, aborting...") + if 'failed' in cnt and cnt['failed'] >= 2: + log("%d clients failed, aborting..."%(cnt['failed'],)) stage2(pipes, status, 'abort') return False - elif 'waiting' in cnt > 0: + + failedmirrorsfile = os.path.join(base, 'master', component + "-failedmirrors") + if 'failed' in cnt: + log("WARNING: %d clients failed! Continuing anyway!"%(cnt['failed'],)) + global had_warnings + had_warnings = True + f = open(failedmirrorsfile, "w") + for c in status: + if status[c] == 'failed': f.write(c+"\n") + f.close() + else: + if os.path.exists(failedmirrorsfile): os.unlink(failedmirrorsfile) + + if 'waiting' in cnt: log("Committing...") stage2(pipes, status, 'go') return True @@ -160,7 +174,8 @@ def run_mirror(component): os.rename(cur, live) log("Cleaning up.") shutil.rmtree(tmpdir_old) - log("Done.") + if had_warnings: log("Done, with warnings.") + else: log("Done.") ret = True else: log("Aborted.")