feat: add helper scripts for infrastructure management and troubleshooting
This commit is contained in:
29
scripts/test_aerodrome_root.py
Normal file
29
scripts/test_aerodrome_root.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import paramiko
|
||||
import sys
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
key_path = r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet'
|
||||
|
||||
def run_ssh(host, user, cmd):
|
||||
print(f"=== SSH {user}@{host}: {cmd} ===")
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
try:
|
||||
ssh.connect(host, username=user, key_filename=key_path, timeout=10)
|
||||
stdin, stdout, stderr = ssh.exec_command(cmd)
|
||||
out = stdout.read().decode('utf-8', errors='replace')
|
||||
err = stderr.read().decode('utf-8', errors='replace')
|
||||
if out:
|
||||
print(out)
|
||||
if err:
|
||||
print("STDERR:", err)
|
||||
except Exception as e:
|
||||
print(f"Error connecting to {host}: {e}")
|
||||
finally:
|
||||
ssh.close()
|
||||
|
||||
# Test Aerodrome with root
|
||||
run_ssh('140.44.4.11', 'root', 'k3s kubectl get pods -n dns -o wide')
|
||||
run_ssh('140.44.4.11', 'root', 'k3s kubectl get svc -n dns -o wide')
|
||||
|
||||
Reference in New Issue
Block a user