]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
DaemonState: add wait() 419/head
authorSage Weil <sage@redhat.com>
Fri, 23 Jan 2015 23:33:43 +0000 (15:33 -0800)
committerSage Weil <sage@redhat.com>
Fri, 23 Jan 2015 23:34:29 +0000 (15:34 -0800)
Signed-off-by: Sage Weil <sage@redhat.com>
teuthology/orchestra/daemon.py

index 21de682232c83dab8aef5e42f94447c4792477dd..df42410e7d4d86c5ec484fb1d72f287fe1791975 100644 (file)
@@ -46,6 +46,23 @@ class DaemonState(object):
         self.proc = None
         self.log.info('Stopped')
 
+        """
+        Wait for daemon to exit
+
+        Wait for daemon to stop (but don't trigger the stop).  Pass up
+        any exception.  Mark the daemon as not running.
+        """
+    def wait(self, timeout=300):
+        self.log.debug('waiting for process to exit')
+        try:
+            run.wait([self.proc], timeout=timeout)
+            self.log.info('Stopped')
+        except:
+            self.log.info('Failed')
+            raise
+        finally:
+            self.proc = None
+
     def restart(self, *args, **kwargs):
         """
         Restart with a new command passed in the arguments