feat: add various infrastructure check and automation scripts
This commit is contained in:
34
scripts/set_heimdall_public.py
Normal file
34
scripts/set_heimdall_public.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import paramiko
|
||||
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect("140.44.4.71", username="snarf", password="Katzir476!", timeout=10)
|
||||
|
||||
py_code = """
|
||||
import sqlite3
|
||||
|
||||
db_path = '/var/lib/docker-data/heimdall/config/www/app.sqlite'
|
||||
con = sqlite3.connect(db_path)
|
||||
cur = con.cursor()
|
||||
|
||||
# Set public_front to 1 for user 1 so dashboard tiles are always visible even when logged out!
|
||||
cur.execute('UPDATE users SET public_front = 1 WHERE id = 1')
|
||||
con.commit()
|
||||
|
||||
print('Updated user 1:')
|
||||
print(cur.execute('SELECT id, username, email, public_front FROM users WHERE id = 1').fetchone())
|
||||
con.close()
|
||||
"""
|
||||
|
||||
stdin, stdout, stderr = c.exec_command("cat > /tmp/set_public_front.py")
|
||||
stdin.write(py_code)
|
||||
stdin.close()
|
||||
stdout.channel.recv_exit_status()
|
||||
|
||||
_, o, e = c.exec_command("echo Katzir476! | sudo -S python3 /tmp/set_public_front.py")
|
||||
print(o.read().decode())
|
||||
if e.read().decode():
|
||||
print("ERR:", e.read().decode())
|
||||
|
||||
c.close()
|
||||
|
||||
Reference in New Issue
Block a user