I have EFlow running on a remote machine and want to poll the status to ensure that it is running.
If I SSH into the machine, it is as easy as running the command
powershell Get-EflowVm
however, automating this in a python script have proven more difficult. In general, ssh via python works like a charm, I just can't get it to run this command. Somehow, specifically when running this command (and not other powershell commands via python and ssh) it stalls, does not execute the command, and end up timing out.
I have tried in a few different ways to do this manouvre, some examples below:
import subprocess
r = subprocess.Popen(f"sshpass -p <pw> ssh <user>@<host> ""powershell Get-EflowVm", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate(timeout=60)
or with paramiko:
import paramiko
host = <host>
user = <user>
pw = <pw>
client = paramiko.client.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(host, port=22, username=user, password=pw, timeout=60)
stdin, stdout, stderr = client.exec_command("powershell Get-EflowVm")
client.close()
Again, in either case, it just hangs and provides no response. Other powershell commands work, and if I manually ssh into the machine and execute the powershell command, I get a response just fine.
Any help would be much appreciated.
I was able to solve this without really knowing what the difference in practice is compared to what I was already doing. It works, however.