feat: add various infrastructure check and automation scripts
This commit is contained in:
26
scripts/fix_node1_sdc.py
Normal file
26
scripts/fix_node1_sdc.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import paramiko
|
||||
|
||||
SSH_KEY = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet"
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect("140.44.4.81", username="rancher", key_filename=SSH_KEY, timeout=10)
|
||||
|
||||
def run_cmd(cmd):
|
||||
full_cmd = f"echo Katzir476! | sudo -S sh -c '{cmd}'"
|
||||
_, o, e = c.exec_command(full_cmd)
|
||||
return o.read().decode().strip(), e.read().decode().strip()
|
||||
|
||||
print("Check /dev/sdc with file and blkid:")
|
||||
out, _ = run_cmd("file -s /dev/sdc; blkid /dev/sdc; dmesg | tail -n 20")
|
||||
print(out)
|
||||
|
||||
print("\nRunning fsck on /dev/sdc:")
|
||||
out, err = run_cmd("fsck.ext4 -fy /dev/sdc")
|
||||
print(out, err)
|
||||
|
||||
print("\nTry mounting /dev/sdc now:")
|
||||
out, err = run_cmd("mkdir -p /tmp/sdc_test && mount /dev/sdc /tmp/sdc_test && ls -la /tmp/sdc_test; cat /tmp/sdc_test/longhorn-disk.cfg 2>/dev/null; umount /tmp/sdc_test 2>/dev/null")
|
||||
print(out, err)
|
||||
|
||||
c.close()
|
||||
|
||||
Reference in New Issue
Block a user