Check whether our mirror packages are up to date.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mirror-checker/projects/saltstack.py

25 lines
840 B

import requests
import datefinder # another date finding library
import re
from datetime import datetime
from project import Project
from shared import CSC_MIRROR
class saltstack(Project):
"""saltstack class"""
@staticmethod
def check(data, project):
csc_url = CSC_MIRROR + data[project]["csc"] + data[project]["file"]
upstream_url = data[project]["upstream"] + data[project]["file"]
page1 = requests.get(csc_url).text
page2 = requests.get(upstream_url).text
CSC_release = re.search(r'Latest release: (\d)+.(\d)+ \((.+)\)', page1)
upstream_release = re.search(r'Latest release: (\d)+.(\d)+ \((.+)\)', page2)
# print(CSC_release.group(0))
# print(upstream_release.group(0))
return CSC_release.group(0) == upstream_release.group(0)