Fixed broken ubuntu and ubuntu_ports mirror checks
This commit is contained in:
parent
54d8a47944
commit
5afebc8030
|
@ -5,6 +5,7 @@ Contains ubuntu class
|
||||||
import os
|
import os
|
||||||
from project import Project
|
from project import Project
|
||||||
from shared import CSC_MIRROR
|
from shared import CSC_MIRROR
|
||||||
|
from shared import NUM_UBUNTU_RELEASES
|
||||||
import requests
|
import requests
|
||||||
import datefinder # another date finding library
|
import datefinder # another date finding library
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
@ -17,4 +18,4 @@ class ubuntu(Project):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check(data, project, current_time):
|
def check(data, project, current_time):
|
||||||
page = requests.get(data[project]["upstream"]).text
|
page = requests.get(data[project]["upstream"]).text
|
||||||
return page.count("Up to date") == 21
|
return page.count("Up to date") == NUM_UBUNTU_RELEASES
|
||||||
|
|
|
@ -5,6 +5,7 @@ Contains ubuntu_releases class
|
||||||
import os
|
import os
|
||||||
from project import Project
|
from project import Project
|
||||||
from shared import CSC_MIRROR
|
from shared import CSC_MIRROR
|
||||||
|
from shared import NUM_UBUNTU_RELEASES
|
||||||
import requests
|
import requests
|
||||||
import datefinder # another date finding library
|
import datefinder # another date finding library
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
@ -17,10 +18,4 @@ class ubuntu_releases(Project):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check(data, project, current_time):
|
def check(data, project, current_time):
|
||||||
page = requests.get(data[project]["upstream"]).text
|
page = requests.get(data[project]["upstream"]).text
|
||||||
indexOfFile = page.find("last verified")
|
return page.count("Up to date") == NUM_UBUNTU_RELEASES
|
||||||
matches = list(datefinder.find_dates(page[indexOfFile:]))
|
|
||||||
date = matches[0].replace(tzinfo=None) # date is of type datetime.datetime
|
|
||||||
data[project]["out_of_sync_since"] = date.timestamp()
|
|
||||||
return(pd.to_datetime(current_time, unit='s') - date <= pd.to_timedelta(data[project]["out_of_sync_interval"], unit='s'))
|
|
||||||
|
|
||||||
# https://launchpad.net/ubuntu/+mirror/mirror.csclub.uwaterloo.ca-release
|
|
||||||
|
|
Loading…
Reference in New Issue