1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
Description: Prefer resolvectl over systemd-resolve
The latter is a deprecated compat symlink.
Author: Michael Biebl <biebl@debian.org>
Origin: upstream, https://github.com/sosreport/sos/commit/110757df526d79b2b257077bef78d2553f43e4a7
Bug: https://github.com/sosreport/sos/pull/2385
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=979264
--- a/sos/report/plugins/systemd.py
+++ b/sos/report/plugins/systemd.py
@@ -10,6 +10,7 @@
from sos.report.plugins import (Plugin, RedHatPlugin, DebianPlugin,
UbuntuPlugin, CosPlugin, SoSPredicate)
+from sos.utilities import is_executable
class Systemd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, CosPlugin):
@@ -47,11 +48,17 @@
"timedatectl"
])
- # systemd-resolve command starts systemd-resolved service if that
+ # resolvectl command starts systemd-resolved service if that
# is not running, so gate the commands by this predicate
+ if is_executable('resolvectl'):
+ resolvectl_status = 'resolvectl status'
+ resolvectl_statistics = 'resolvectl statistics'
+ else:
+ resolvectl_status = 'systemd-resolve --status'
+ resolvectl_statistics = 'systemd-resolve --statistics'
self.add_cmd_output([
- "systemd-resolve --status",
- "systemd-resolve --statistics",
+ resolvectl_status,
+ resolvectl_statistics,
], pred=SoSPredicate(self, services=["systemd-resolved"]))
self.add_cmd_output("systemd-analyze plot",
|