]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
teuthology/orchestra/daemon: Check if stdin is valid
authorJos Collin <jcollin@redhat.com>
Wed, 3 Jul 2019 12:45:55 +0000 (18:15 +0530)
committerJos Collin <jcollin@redhat.com>
Sat, 6 Jul 2019 06:27:51 +0000 (11:57 +0530)
As there is self.proc.stdin.close() in stop(), there are chances
of write failing with IOError("File is closed").

Signed-off-by: Jos Collin <jcollin@redhat.com>
teuthology/orchestra/daemon/state.py

index 66a22fd878deb272b4783bff94cc4c6e0a3d2f70..4017abc81a9788e1c7f86a617570d0af11494301 100644 (file)
@@ -103,7 +103,10 @@ class DaemonState(object):
         :param sig: signal to send
         """
         if self.running():
-            self.proc.stdin.write(struct.pack('!b', sig))
+            try:
+                self.proc.stdin.write(struct.pack('!b', sig))
+            except IOError as e:
+                log.exception('Failed to send signal %d: %s', sig, e.strerror)
             if not silent:
                 self.log.info('Sent signal %d', sig)
         else: