Skip to content

Commit

Permalink
Prefer resolvectl over systemd-resolve
Browse files Browse the repository at this point in the history
The latter is a deprecated compat symlink.

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=979264

Signed-off-by: Michael Biebl <biebl@debian.org>
  • Loading branch information
mbiebl committed Jan 26, 2021
1 parent 3973d0d commit a8caa40
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions sos/report/plugins/systemd.py
Expand Up @@ -9,6 +9,7 @@
# See the LICENSE file in the source distribution for further information.

from sos.report.plugins import Plugin, IndependentPlugin, SoSPredicate
from sos.utilities import is_executable


class Systemd(Plugin, IndependentPlugin):
Expand Down Expand Up @@ -47,11 +48,17 @@ def setup(self):
"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
resolvectl_status = 'resolvectl status' \
if is_executable('resolvectl') \
else 'systemd-resolve --status'
resolvectl_statistics = 'resolvectl statistics' \
if is_executable('resolvectl') \
else '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",
Expand Down

0 comments on commit a8caa40

Please sign in to comment.