"""Check AD2 for Python/Node availability."""
import paramiko, subprocess, yaml
pwd_raw = yaml.safe_load(subprocess.run(['sops','-d','D:/vault/clients/dataforth/ad2.sops.yaml'],
    capture_output=True, text=True, timeout=30, check=True).stdout)['credentials']['password']
PWD = pwd_raw.replace('\\', '')
c = paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect('192.168.0.6', username='sysadmin', password=PWD,
          timeout=30, banner_timeout=45, look_for_keys=False, allow_agent=False)
for cmd in ['where python', 'where python3', 'where node', 'python --version 2>&1']:
    print(f'$ {cmd}')
    _, o, _ = c.exec_command(cmd, timeout=15)
    print(o.read().decode().rstrip())
    print()
c.close()
