diff options
author | Guido Günther <agx@sigxcpu.org> | 2016-04-07 21:18:21 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2016-04-08 09:49:20 +0200 |
commit | 73afbae396ca636140d7732eef46994aebbf25bf (patch) | |
tree | ee37779b5e689121484da612c01afc82fe24bf1e /whatmaps | |
parent | 6d8d500a5f001dc0c84e0f2890b16f56409a62bb (diff) |
systemd: Shorten error message if proess is from a user session
No need to print the whole process tree which so far looked like
WARNING: No systemd unit found for '/bin/bash': Can't parse service name from
● session-8762.scope - Session 8762 of user root
Loaded: loaded
Drop-In: /run/systemd/system/session-8762.scope.d
└─50-After-systemd-logind\x2eservice.conf, 50-After-systemd-user-sessions\x2eservice.conf, 50-Description.conf, 50-SendSIGHUP.conf, 50-Slice.conf
Active: active (running) since Thu 2016-04-07 20:53:52 CEST; 19min ago
CGroup: /user.slice/user-0.slice/session-8762.scope
├─21150 sshd: root@pts/0
├─21155 -bash
├─23956 /usr/bin/python /usr/bin/whatmaps --debug libc6
└─23962 systemctl status 21155
Diffstat (limited to 'whatmaps')
-rw-r--r-- | whatmaps/systemd.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/whatmaps/systemd.py b/whatmaps/systemd.py index 9bc03b1..d4f45fe 100644 --- a/whatmaps/systemd.py +++ b/whatmaps/systemd.py @@ -43,5 +43,8 @@ class Systemd(object): return parts[0] elif parts[1].endswith('.service'): return parts[1] + elif parts[1].startswith('session-') and parts[1].endswith('.scope'): + msg = output.decode('utf-8').split('\n')[0][2:] + raise ValueError("Can't parse service name from %s" % msg) else: raise ValueError("Can't parse service name from: (%s %s)" % (parts[0], parts[1])) |