feat: add various infrastructure check and automation scripts
This commit is contained in:
36
scripts/check_settings_yml.py
Normal file
36
scripts/check_settings_yml.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import paramiko
|
||||
import sys
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect('140.44.4.74', username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
def run(cmd):
|
||||
stdin, stdout, stderr = c.exec_command(cmd)
|
||||
return stdout.read().decode().strip(), stderr.read().decode().strip()
|
||||
|
||||
print("--- settings.yml ---")
|
||||
out, _ = run("cat /mnt/swarm_shared/legacy_volumes/peanut/settings.yml")
|
||||
print(out)
|
||||
|
||||
print("\n--- Test network from 140.44.4.74 to 14.4.4.44:3493 using python socket ---")
|
||||
test_sock = """
|
||||
import socket
|
||||
s = socket.socket()
|
||||
s.settimeout(3)
|
||||
try:
|
||||
s.connect(('14.4.4.44', 3493))
|
||||
print('SUCCESS connecting to 14.4.4.44:3493')
|
||||
s.sendall(b'VER\\n')
|
||||
print('Response:', s.recv(1024))
|
||||
except Exception as e:
|
||||
print('FAIL:', e)
|
||||
finally:
|
||||
s.close()
|
||||
"""
|
||||
out, _ = run(f"python3 -c {repr(test_sock)}")
|
||||
print(out)
|
||||
|
||||
c.close()
|
||||
|
||||
Reference in New Issue
Block a user