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

also check apt, refs #20596

parent 08118105
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ es_utils = imp.load_source('es_utils', '../utils.py')
conf = es_utils.load_conf()
def check_ssh(ip):
cmd = '/usr/bin/ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no %s ls /tmp' % ip
cmd = 'ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no %s ls /tmp' % ip
print('Connecting: %s' % cmd)
try:
subprocess.check_output(cmd, shell=True, timeout=2)
......@@ -32,11 +32,21 @@ def check_ssh(ip):
return False
return True
def check_apt(ip):
cmd = 'ssh %s apt-get update' % ip
try:
subprocess.check_output(cmd, shell=True, timeout=10)
print('%sapt-get update success on MediaWorker%s' % (GREEN, DEF))
except subprocess.CalledProcessError:
print('%apt-get update failed on MediaWorker%s' % (RED, DEF))
return False
all_ok = True
worker_ip = conf.get('CELERITY_WORKER_IP')
if worker_ip != '127.0.1.1':
if not check_ssh(worker_ip):
all_ok = False
if not check_apt(worker_ip):
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