From: Jos Collin Date: Fri, 28 Jun 2019 12:00:40 +0000 (+0530) Subject: orchestra/daemon: Fix proc AttributeError: 'NoneType' X-Git-Tag: 1.1.0~241^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2d1c4acce22d87b68a3da1d9329424cee4c474bd;p=teuthology.git orchestra/daemon: Fix proc AttributeError: 'NoneType' Fixes the chance of calling signal() on a daemon which is not running. Signed-off-by: Jos Collin --- diff --git a/teuthology/orchestra/daemon/state.py b/teuthology/orchestra/daemon/state.py index 9fdf77b9a..66a22fd87 100644 --- a/teuthology/orchestra/daemon/state.py +++ b/teuthology/orchestra/daemon/state.py @@ -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): """