]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Fixed empty string split issue 1514/head
authorsunilkumarn417 <sunnagar@redhat.com>
Fri, 19 Jun 2020 04:46:46 +0000 (10:16 +0530)
committersunilkumarn417 <sunnagar@redhat.com>
Fri, 19 Jun 2020 10:29:38 +0000 (15:59 +0530)
Signed-off-by: sunilkumarn417 <sunnagar@redhat.com>
teuthology/orchestra/daemon/systemd.py

index c202669fbe2be63c836d1ab581eca909359b0969..8d43520cf56ab6ba02612136fcedcec42dfef0d7 100644 (file)
@@ -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':