feat: add various infrastructure check and automation scripts
This commit is contained in:
27
scripts/test_mount_sdb.py
Normal file
27
scripts/test_mount_sdb.py
Normal file
@@ -0,0 +1,27 @@
|
||||
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("Listing /var/lib/harvester/extra-disks/:")
|
||||
out, _ = run_cmd("ls -la /var/lib/harvester/extra-disks/")
|
||||
print(out)
|
||||
|
||||
# Check mount command for /dev/sdb to /var/lib/harvester/extra-disks/sdb
|
||||
print("\nTest mounting /dev/sdb on /var/lib/harvester/extra-disks/sdb:")
|
||||
out, err = run_cmd("mount /dev/sdb /var/lib/harvester/extra-disks/sdb; ls -la /var/lib/harvester/extra-disks/sdb")
|
||||
print(out, err)
|
||||
|
||||
# Check if longhorn-disk.cfg exists on /dev/sdb
|
||||
out, _ = run_cmd("ls -la /var/lib/harvester/extra-disks/sdb/longhorn-disk.cfg 2>/dev/null; cat /var/lib/harvester/extra-disks/sdb/longhorn-disk.cfg 2>/dev/null")
|
||||
print("longhorn-disk.cfg:", out)
|
||||
|
||||
c.close()
|
||||
|
||||
Reference in New Issue
Block a user