Files
SnarfCode/scripts/check_semaphore_help.py

15 lines
662 B
Python

import paramiko
import time
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('140.44.4.41', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
ssh.exec_command('kubectl run semaphore-test --image=semaphoreui/semaphore:v2.19.17 --restart=Never -n infrastructure --command -- strings /usr/bin/semaphore')
time.sleep(6)
_, out, _ = ssh.exec_command('kubectl logs semaphore-test -n infrastructure | grep -E "mysql|postgres|bolt" | head -n 30')
print(out.read().decode())
ssh.exec_command('kubectl delete pod semaphore-test -n infrastructure --grace-period=0 --force')
ssh.close()