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

Added some messages in SSH test.

parent bc8f0ac9
No related branches found
No related tags found
No related merge requests found
......@@ -5,11 +5,12 @@
Criticality: Medium
Checks that the server backups are not older than a day.
'''
from datetime import datetime
import imp
import os
import sys
import subprocess
import imp
from datetime import datetime
import sys
GREEN = '\033[92m'
RED = '\033[91m'
......@@ -42,6 +43,8 @@ def test_last_backup_is_recent(server, client):
print('There is a backup that is less than 2 days old, this is fine')
return True
else:
out = out or 'No output.'
print('SSH access is not working (code: %s):\n%s' % (status, out))
return False
......@@ -50,7 +53,7 @@ if os.path.isfile('../utils.py'):
es_utils = imp.load_source('es_utils', '../utils.py')
conf = es_utils.load_conf()
BURP_SERVER = conf.get('BURP_SERVER')
BURP_CLIENT_NAME = conf.get('BURP_CLIENT_NAME', 'localhost')
BURP_CLIENT_NAME = conf.get('BURP_CLIENT_NAME') or 'localhost'
if BURP_SERVER:
if not test_ssh(BURP_SERVER):
print('Failed to ssh into backup server')
......@@ -61,7 +64,8 @@ if os.path.isfile('../utils.py'):
else:
sys.exit(0)
else:
print('No BURP_SERVER defined in config, untestable')
sys.exit(2)
else:
print('No BURP_SERVER defined in config, untestable')
print('Unable to load config, untestable')
sys.exit(2)
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