Skip to content
Snippets Groups Projects
Commit 11d36560 authored by Florent Thiery's avatar Florent Thiery
Browse files

add apt cache test, refs #20589

parent 381f1378
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2017, Florent Thiery
'''
Criticality: Normal
Checks that packages mirror works for capture systems
'''
import os
import sys
import requests
import imp
GREEN = '\033[92m'
RED = '\033[91m'
DEF = '\033[0m'
os.chdir(os.path.dirname(__file__))
if not os.path.isfile('../utils.py'):
print('conf.sh not found')
sys.exit(1)
es_utils = imp.load_source('es_utils', '../utils.py')
conf = es_utils.load_conf()
all_ok = True
conf_servers = (
'CM_SERVER_NAME',
)
for s in conf_servers:
v = conf.get(s)
try:
url = "https://%s/old-releases.ubuntu.com/ubuntu/dists/lucid/Release.gpg" % v
print('Checking url certificate %s' % url)
d = requests.get(url, verify=False)
if not "BEGIN PGP SIGNATURE" in d:
all_ok = False
print('Unexpected content: %s' % d)
except Exception:
print('Package mirror not working')
all_ok = False
sys.exit(int(not all_ok))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment