From: sunilkumarn417 Date: Tue, 18 Aug 2020 08:03:04 +0000 (+0530) Subject: Fix py3 comparison issue(None with integers) in pid method and X-Git-Tag: 1.1.0~55^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4956dfd4297c48611773b0cfaac1c96899fa3fe8;p=teuthology.git Fix py3 comparison issue(None with integers) in pid method and Fix split issue which creates empty string value due to newline character at end of command response. Signed-off-by: sunilkumarn417 --- diff --git a/teuthology/orchestra/daemon/systemd.py b/teuthology/orchestra/daemon/systemd.py index 03d00eca82..204f9422c6 100644 --- a/teuthology/orchestra/daemon/systemd.py +++ b/teuthology/orchestra/daemon/systemd.py @@ -85,7 +85,7 @@ class SystemDState(DaemonState): # Main process exited, code=exited, status=1/FAILURE self.status_cmd + " | grep 'Main.*code=exited'", ) - line = out.split('\n')[-1] + line = out.strip().split('\n')[-1] exit_code = int(re.match('.*status=(\d+).*', line).groups()[0]) if exit_code: self.remote.run( @@ -167,10 +167,12 @@ class SystemDState(DaemonState): :return: The PID if remote run command value is set, False otherwise. """ pid = self.pid - if pid > 0: - return pid - else: + if pid is None: + return None + elif pid <= 0: return None + else: + return pid def signal(self, sig, silent=False): """