]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
orchestra/daemon: Fix proc AttributeError: 'NoneType' 1295/head
authorJos Collin <jcollin@redhat.com>
Fri, 28 Jun 2019 12:00:40 +0000 (17:30 +0530)
committerJos Collin <jcollin@redhat.com>
Fri, 28 Jun 2019 12:02:44 +0000 (17:32 +0530)
Fixes the chance of calling signal() on a  daemon which is not running.

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

index 9fdf77b9a776226f648fbcd90d25d4ed8bfe0d9d..66a22fd878deb272b4783bff94cc4c6e0a3d2f70 100644 (file)
@@ -98,13 +98,16 @@ class DaemonState(object):
 
     def signal(self, sig, silent=False):
         """
-        Send a signal to associated remote commnad
+        Send a signal to associated remote command.
 
         :param sig: signal to send
         """
-        self.proc.stdin.write(struct.pack('!b', sig))
-        if not silent:
-            self.log.info('Sent signal %d', sig)
+        if self.running():
+            self.proc.stdin.write(struct.pack('!b', sig))
+            if not silent:
+                self.log.info('Sent signal %d', sig)
+        else:
+            self.log.info('No such daemon running')
 
     def start(self, timeout=300):
         """