summaryrefslogtreecommitdiff
path: root/whatmaps/systemd.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-12-28 14:49:03 +0100
committerGuido Günther <agx@sigxcpu.org>2014-12-28 14:59:02 +0100
commit9b32d5e86ef7ad4b4e802ec8fb16b21fb47d45b8 (patch)
tree31c5335278ccebfaeeb10a41ac632a426d2e07f9 /whatmaps/systemd.py
parent8c5b2930b37f7cf6fd0a44e4283bf2c79fbc13bd (diff)
Fix service name parsing for systemd >= 215
Newer systemd put a colored bullet point '●' in front of the service name output: # sudo systemctl status 971 ● libvirtd.service - Virtualization daemon ... Skip that.
Diffstat (limited to 'whatmaps/systemd.py')
-rw-r--r--whatmaps/systemd.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/whatmaps/systemd.py b/whatmaps/systemd.py
index add6d0e..3407128 100644
--- a/whatmaps/systemd.py
+++ b/whatmaps/systemd.py
@@ -38,4 +38,10 @@ class Systemd(object):
if systemctl_status.returncode:
return None
else:
- return output.split()[0]
+ parts = output.split()
+ if parts[0].endswith('.service'):
+ return parts[0]
+ elif parts[1].endswith('.service'):
+ return parts[1]
+ else:
+ raise ValueError("Can't parse service name from\n%s" % output)