Files
SnarfCode/scripts/inspect_semaphore_boltdb.py

24 lines
802 B
Python

import paramiko
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)
py_script = """python3 -c '
# Simple BoltDB reader without external dependencies
# Or let us inspect with strings or hexdump
import os
print("BoltDB file size:", os.path.getsize("/var/lib/semaphore/database.boltdb"))
'"""
# In the pod, let us see if boltdb has project records
cmd = """kubectl exec -n infrastructure deployment/semaphore -c semaphore -- /bin/sh -c '
strings /var/lib/semaphore/database.boltdb | grep -E "name|title|playbook|project" | head -n 40
'"""
_, out, err = ssh.exec_command(cmd)
print("Strings from Semaphore BoltDB:")
print(out.read().decode())
ssh.close()