aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xwhatmaps/command.py7
-rw-r--r--whatmaps/systemd.py8
2 files changed, 13 insertions, 2 deletions
diff --git a/whatmaps/command.py b/whatmaps/command.py
index 0a4eb7b..d0f5c3e 100755
--- a/whatmaps/command.py
+++ b/whatmaps/command.py
@@ -113,7 +113,12 @@ def find_systemd_units(procmap, distro):
for dummy, procs in procmap.items():
for proc in procs:
- unit = Systemd.process_to_unit(proc)
+ try:
+ unit = Systemd.process_to_unit(proc)
+ except ValueError as e:
+ logging.warning("No systemd unit found for '%s': %s"
+ "- restart manually" % (proc.exe, e))
+ continue
if not unit:
logging.warning("No systemd unit found for '%s'"
"- restart manually" % proc.exe)
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)