forked from public/mirror-checker
Created Ceph mirror status checker
This commit is contained in:
parent
4b3f85374e
commit
0fc80fd972
|
@ -0,0 +1,21 @@
|
||||||
|
"""
|
||||||
|
Contains Ceph class
|
||||||
|
"""
|
||||||
|
|
||||||
|
from distro import Distro
|
||||||
|
from shared import CSC_MIRROR, get_sec
|
||||||
|
|
||||||
|
class Ceph(Distro):
|
||||||
|
"""Ceph class"""
|
||||||
|
@staticmethod
|
||||||
|
def name():
|
||||||
|
"""Get name of Ceph"""
|
||||||
|
return "Ceph"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def check():
|
||||||
|
"""Check if Ceph packages are up-to-date"""
|
||||||
|
official_sec = get_sec("https://download.ceph.com/timestamp")
|
||||||
|
csc_sec = get_sec(f"{CSC_MIRROR}ceph/timestamp")
|
||||||
|
# Out-of-sync by 1 day maximum
|
||||||
|
return official_sec < csc_sec + 86400
|
3
main.py
3
main.py
|
@ -6,6 +6,7 @@ This mirror status checker determines whether CSC mirror is up-to-date with upst
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from arch import Arch
|
from arch import Arch
|
||||||
|
from ceph import Ceph
|
||||||
from debian import Debian
|
from debian import Debian
|
||||||
from eclipse import Eclipse
|
from eclipse import Eclipse
|
||||||
from gnu import GNU
|
from gnu import GNU
|
||||||
|
@ -13,7 +14,7 @@ from kernel import Kernel
|
||||||
from openbsd import OpenBSD
|
from openbsd import OpenBSD
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
for distro in [Arch, Debian, Eclipse, GNU, Kernel, OpenBSD]:
|
for distro in [Arch, Ceph, Debian, Eclipse, GNU, Kernel, OpenBSD]:
|
||||||
try:
|
try:
|
||||||
distro.print_output(distro.check())
|
distro.print_output(distro.check())
|
||||||
except requests.exceptions.RequestException as err:
|
except requests.exceptions.RequestException as err:
|
||||||
|
|
Loading…
Reference in New Issue