def setup(): global ssh_client ssh_client = SSHClient(host=hostname, user=username, password=password) ssh_client.connect() ssh_client.send("source /etc/platform/openrc") ssh_client.prompt = ssh.ADMIN_PROMPT ssh_client.expect()
def connect_functest(functest_host, username, password): global ssh_client try: ssh_client = SSHClient(host=functest_host, user=username, password=password, initial_prompt=FUNCTEST_SERVER_PROMPT) ssh_client.connect() # check if Docker exists on functest_host, if not, SSH will throw exception ssh_client.send("which docker", flush=True) ssh_client.expect("/usr/bin/docker", timeout=10) except Exception as e: print(str(e)) print("ERROR in Test: Wrong functest Host, Docker is not installed !")