From 2d1c4acce22d87b68a3da1d9329424cee4c474bd Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Fri, 28 Jun 2019 17:30:40 +0530 Subject: [PATCH] orchestra/daemon: Fix proc AttributeError: 'NoneType' Fixes the chance of calling signal() on a daemon which is not running. Signed-off-by: Jos Collin --- teuthology/orchestra/daemon/state.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/teuthology/orchestra/daemon/state.py b/teuthology/orchestra/daemon/state.py index 9fdf77b9a7..66a22fd878 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): """ -- 2.39.5