Skip to content
Snippets Groups Projects
Commit 7e50801e authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

PEP8 cleaning.

parent 903a08e1
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Copyright 2017, Florent Thiery # Copyright 2017, Florent Thiery
''' '''
Criticality: Normal Criticality: Normal
Checks that packages mirror works for capture systems Checks that packages mirror works for capture systems
''' '''
import os import os
import sys import sys
...@@ -35,10 +35,10 @@ conf_servers = ( ...@@ -35,10 +35,10 @@ conf_servers = (
for s in conf_servers: for s in conf_servers:
v = conf.get(s) v = conf.get(s)
try: try:
url = "https://%s/old-releases.ubuntu.com/ubuntu/dists/lucid/Release.gpg" % v url = 'https://%s/old-releases.ubuntu.com/ubuntu/dists/lucid/Release.gpg' % v
print('Checking url certificate %s' % url) print('Checking url certificate %s' % url)
d = requests.get(url, verify=False).text d = requests.get(url, verify=False).text
if not "BEGIN PGP SIGNATURE" in d: if 'BEGIN PGP SIGNATURE' not in d:
all_ok = False all_ok = False
print('%sUnexpected content: %s%s' % (RED, d, DEF)) print('%sUnexpected content: %s%s' % (RED, d, DEF))
else: else:
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# Copyright 2017, Florent Thiery # Copyright 2017, Florent Thiery
''' '''
Criticality: Medium Criticality: Medium
Checks that the server backups are not older than a day Checks that the server backups are not older than a day.
''' '''
import os import os
import sys import sys
...@@ -15,7 +15,6 @@ GREEN = '\033[92m' ...@@ -15,7 +15,6 @@ GREEN = '\033[92m'
RED = '\033[91m' RED = '\033[91m'
DEF = '\033[0m' DEF = '\033[0m'
os.chdir(os.path.dirname(__file__))
def test_ssh(ip): def test_ssh(ip):
cmd = 'ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no %s ls /tmp' % ip cmd = 'ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no %s ls /tmp' % ip
...@@ -28,6 +27,7 @@ def test_ssh(ip): ...@@ -28,6 +27,7 @@ def test_ssh(ip):
return False return False
return True return True
def test_last_backup_is_recent(server, client): def test_last_backup_is_recent(server, client):
path = '/backup/%s/current' % client path = '/backup/%s/current' % client
cmd = 'ssh -o StrictHostKeyChecking=no %s ls -l %s | grep current' % (server, path) cmd = 'ssh -o StrictHostKeyChecking=no %s ls -l %s | grep current' % (server, path)
...@@ -44,10 +44,12 @@ def test_last_backup_is_recent(server, client): ...@@ -44,10 +44,12 @@ def test_last_backup_is_recent(server, client):
else: else:
return False return False
os.chdir(os.path.dirname(__file__))
if os.path.isfile('../utils.py'): if os.path.isfile('../utils.py'):
es_utils = imp.load_source('es_utils', '../utils.py') es_utils = imp.load_source('es_utils', '../utils.py')
conf = es_utils.load_conf() conf = es_utils.load_conf()
BURP_SERVER = conf.get('BURP_SERVER') BURP_SERVER = conf.get('BURP_SERVER')
BURP_CLIENT_NAME = conf.get('BURP_CLIENT_NAME', 'localhost') BURP_CLIENT_NAME = conf.get('BURP_CLIENT_NAME', 'localhost')
if BURP_SERVER: if BURP_SERVER:
if not test_ssh(BURP_SERVER): if not test_ssh(BURP_SERVER):
......
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