27 lines
731 B
Python
27 lines
731 B
Python
import paramiko
|
|
import time
|
|
import yaml
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect('140.44.4.11', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
|
|
|
def run(cmd):
|
|
_, o, e = c.exec_command(cmd)
|
|
out = o.read().decode().strip()
|
|
err = e.read().decode().strip()
|
|
return out + ("\nERR: " + err if err else "")
|
|
|
|
with open("homelab-gitops-repo/manifests/aerodrome/prometheus/prometheus.yaml", "r", encoding="utf-8") as f:
|
|
text = f.read()
|
|
|
|
docs = list(yaml.safe_load_all(text))
|
|
|
|
# Let's inspect docs
|
|
print("Docs count:", len(docs))
|
|
for i, d in enumerate(docs):
|
|
print(i, d.get('kind'), d.get('metadata', {}).get('name'))
|
|
|
|
c.close()
|
|
|