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

port backup test for rsync_tmbackup, refs #21504

parent 356e16ed
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ Checks that the server backups are not older than a day.
from datetime import datetime
import imp
import os
import socket
import subprocess
import sys
......@@ -29,8 +30,9 @@ def test_ssh(ip):
return True
def test_last_backup_is_recent(server, client):
path = '/backup/%s/current' % client
def test_last_backup_is_recent(server):
client = socket.gethostname()
path = '/backup/%s/home/current' % client
cmd = 'ssh -o StrictHostKeyChecking=no %s ls -l %s | grep current' % (server, path)
status, out = subprocess.getstatusoutput(cmd)
if status == 0:
......@@ -53,13 +55,12 @@ 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') or 'localhost'
if BURP_SERVER:
if not test_ssh(BURP_SERVER):
print('Failed to ssh into backup server')
sys.exit(1)
else:
if not test_last_backup_is_recent(BURP_SERVER, BURP_CLIENT_NAME):
if not test_last_backup_is_recent(BURP_SERVER):
sys.exit(1)
else:
sys.exit(0)
......
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