]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
orchestra.run: Fix bug in RemoteProcess.finished
authorZack Cerza <zack@redhat.com>
Thu, 9 Mar 2017 22:27:31 +0000 (15:27 -0700)
committerZack Cerza <zack@redhat.com>
Fri, 10 Mar 2017 20:48:14 +0000 (13:48 -0700)
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 <zack@redhat.com>
teuthology/orchestra/run.py

index cccb8d38970b91fadee92f042182ab397858b532..f765edede0242f2dcd9fc4690fc46370336e27ae 100644 (file)
@@ -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):
         """