From a92fec3f845a2921ade6e03164848cc8d7de2a19 Mon Sep 17 00:00:00 2001 From: gbenhaim Date: Tue, 5 Jun 2018 14:33:13 +0300 Subject: [PATCH] Fix "running" method in SSHVMProvider - Some of the arguments that being passed to "get_ssh_client" should be taken from the VM object and not from the provider. - Check only one time if the VM is reachable via SSH. The purpose of the "running" method is to return the current status of the VM, not to wait until it's running. Signed-off-by: gbenhaim --- lago/vm.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lago/vm.py b/lago/vm.py index 16ae27f9..2fb3b40c 100644 --- a/lago/vm.py +++ b/lago/vm.py @@ -45,12 +45,13 @@ def state(self, *args, **kwargs): def running(self, *args, **kwargs): try: ssh.get_ssh_client( - ip_addr=self.ip(), - host_name=self.name(), + ip_addr=self.vm.ip(), + host_name=self.vm.name(), propagate_fail=False, - ssh_key=self.virt_env.prefix.paths.ssh_id_rsa(), - username=self._spec.get('ssh-user'), - password=self._spec.get('ssh-password'), + ssh_tries=1, + ssh_key=self.vm.virt_env.prefix.paths.ssh_id_rsa(), + username=self.vm._spec.get('ssh-user'), + password=self.vm._spec.get('ssh-password'), ) except ssh.LagoSSHTimeoutException: return False