From: Zack Cerza Date: Thu, 9 Mar 2017 22:27:31 +0000 (-0700) Subject: orchestra.run: Fix bug in RemoteProcess.finished X-Git-Tag: 1.1.0~445^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9ee0d6d6da1b33585637e829dc25f81b01118cc5;p=teuthology.git orchestra.run: Fix bug in RemoteProcess.finished Previously, if wait() had not been called, we didn't have the returncode attribute set. Set it from within the finished property if it isn't already. Signed-off-by: Zack Cerza --- diff --git a/teuthology/orchestra/run.py b/teuthology/orchestra/run.py index cccb8d389..f765edede 100644 --- a/teuthology/orchestra/run.py +++ b/teuthology/orchestra/run.py @@ -137,7 +137,6 @@ class RemoteProcess(object): greenlet.get() status = self._get_exitstatus() - self.exitstatus = self.returncode = status for stream in ('stdout', 'stderr'): if hasattr(self, stream): stream_obj = getattr(self, stream) @@ -173,13 +172,17 @@ class RemoteProcess(object): signal, this returns None instead of paramiko's -1. """ status = self._stdout_buf.channel.recv_exit_status() + self.exitstatus = self.returncode = status if status == -1: status = None return status @property def finished(self): - return self._stdout_buf.channel.exit_status_ready() + ready = self._stdout_buf.channel.exit_status_ready() + if ready: + self._get_exitstatus() + return ready def poll(self): """