From: sunilkumarn417 Date: Fri, 19 Jun 2020 04:46:46 +0000 (+0530) Subject: Fixed empty string split issue X-Git-Tag: 1.1.0~85^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0e7ea11b50259f6272dc2a5b0139e4c44b44f4b7;p=teuthology.git Fixed empty string split issue Signed-off-by: sunilkumarn417 --- diff --git a/teuthology/orchestra/daemon/systemd.py b/teuthology/orchestra/daemon/systemd.py index c202669fbe..8d43520cf5 100644 --- a/teuthology/orchestra/daemon/systemd.py +++ b/teuthology/orchestra/daemon/systemd.py @@ -63,9 +63,15 @@ class SystemDState(DaemonState): def parse_line(line): key, value = line.strip().split('=', 1) return {key.strip(): value.strip()} + show_dict = dict() + for line in output.split('\n'): + # skip empty and commented string + if not line or line.startswith("#"): + continue show_dict.update(parse_line(line)) + active_state = show_dict['ActiveState'] sub_state = show_dict['SubState'] if active_state == 'active':