summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'gard-v2.py')
-rwxr-xr-xgard-v2.py45
1 files changed, 11 insertions, 34 deletions
diff --git a/gard-v2.py b/gard-v2.py
index a811cd3..647501c 100755
--- a/gard-v2.py
+++ b/gard-v2.py
@@ -17,7 +17,7 @@ import urllib2
import check
-rmaxlag=45
+rmaxlag = 45 * 60
dmaxlag = 5.5 * 3600
relmaxlag = 2 * 3600
@@ -89,7 +89,12 @@ for line in file:
handler = add_handler(fname)
info4=grsync+" wants to be a gentoo-portage mirror and is being checked as per Bug #"+bugnum
logging.info(info4)
+ addy = 'rsync://%s/' % addy
check.PortageCheck(addy).check(rmaxlag)
+
+ bugurl1 = "Bug URL : https://bugs.gentoo.org/"+bugnum+" , "+duedate
+ logging.info(bugurl1)
+
# New line for the prettiness
logging.info('')
remove_handler(handler)
@@ -154,43 +159,15 @@ for line in file:
else:
os.makedirs(reportpath)
add_handler(fname)
+
info7 = addy+" wants to be an source mirror and is being checked as per Bug #"+bugnum+ " over rsync"
logging.info(info7)
- target=drsync+"/distfiles/timestamp.x"
- retcode4=subprocess.call(['rsync','-aqP','--no-motd','--contimeout=30',target,'.'])
- lag=False
- ots='Unknown'
- if retcode4 > 0:
- logging.error("return value of rsync during distfiles check was "+str(retcode4))
- else:
- temp=open('timestamp.x','r')
- ots=temp.readline()
- temp.close()
- os.unlink('timestamp.x')
- try:
- t1=ots.split()[0]
- lag=(time.time()-t1)/(60*60)
- except:
- t1=False
- lag=False
-
- # Unique line first
- if t1 is False or lag is False:
- error7 = "Mirror is not reachable or has a corrupt timestamp."
- logging.error(error7)
- elif lag > dmaxlag:
- error7 = "Mirror is lagging by over %.1f hours, difference is : %.2f hours" % (dmaxlag, lag)
- logging.error(error7)
- else:
- info7 = addy+" is in sync, current lag : %.2f hours" % (lag)
- logging.info(info7)
-
+
+ addy = 'rsync://%s/' % addy
+ check.DistfilesCheck(addy).check(dmaxlag)
+
# Now common lines
- tstamp7 = "Timestamp on Mirror : "+str(ots).strip()
- curtime7= "Current time in UTC : "+str(time.strftime("%s %a, %d %b %Y %H:%M:%S +0000", time.gmtime()))
bugurl7 = "Bug URL : https://bugs.gentoo.org/"+bugnum+" , "+duedate
- logging.info(tstamp7)
- logging.info(curtime7)
logging.info(bugurl7)
# New line for the prettiness