aboutsummaryrefslogtreecommitdiff
path: root/whatmaps/command.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-09-23 12:55:47 +0200
committerGuido Günther <agx@sigxcpu.org>2016-09-23 13:14:14 +0200
commit39f306f1783b47cae11c80ba31c86be677eff226 (patch)
tree53ac2c8f16d26144b98703d4e10032b45cca9d41 /whatmaps/command.py
parent04ec8384e2b7332c5f7d047ed28b91c9d15c7327 (diff)
Allow to filter service by regular expressions
Diffstat (limited to 'whatmaps/command.py')
-rwxr-xr-xwhatmaps/command.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/whatmaps/command.py b/whatmaps/command.py
index 7d17191..e28a8b9 100755
--- a/whatmaps/command.py
+++ b/whatmaps/command.py
@@ -129,6 +129,16 @@ def find_systemd_units(procmap, distro):
return units
+def filter_services(distro, services):
+ filtered = distro.filter_services(services)
+ diff = services - filtered
+ if len(diff):
+ logging.warning("Filtered out blacklisted service%s %s - restart manually",
+ 's' if len(diff) > 1 else '',
+ ', '.join(diff))
+ return filtered
+
+
def main(argv):
shared_objects = []
services = None
@@ -229,6 +239,8 @@ def main(argv):
else:
return 0
+ services = filter_services(distro, services)
+
if options.restart:
if options.print_cmds and services:
write_cmd_file(services, options.print_cmds, distro)