import paramiko import time ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect('140.44.4.11', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10) py_code = """ from awx.main.models import Project p = Project.objects.get(name='Snarfnet Infrastructure Playbooks') update = p.update() print(f"Triggered project update: id={update.id}, status={update.status}") """ cmd = f"kubectl exec -i -n awx -c awx-task deployment/awx-task -- awx-manage shell_plus --quiet << 'EOF'\n{py_code}\nEOF" stdin, stdout, stderr = ssh.exec_command(cmd) print(stdout.read().decode()) time.sleep(10) py_check = """ from awx.main.models import Project p = Project.objects.get(name='Snarfnet Infrastructure Playbooks') latest = p.project_updates.order_by('-id').first() print(f"Project '{p.name}' Status: {p.status}") if latest: print(f"Latest Update [{latest.id}]: Status={latest.status}, Result={latest.result_traceback}") """ cmd = f"kubectl exec -i -n awx -c awx-task deployment/awx-task -- awx-manage shell_plus --quiet << 'EOF'\n{py_check}\nEOF" stdin, stdout, stderr = ssh.exec_command(cmd) print(stdout.read().decode()) ssh.close()