From 1f73e7affeb96bf69715b43750010a6d62abb93c Mon Sep 17 00:00:00 2001 From: Nikhil Kshirsagar Date: Fri, 4 Aug 2023 18:22:53 +0530 Subject: [PATCH] [plugins/ubuntu] Do not load tls module if not loaded Adds a predicate to avoid loading the tls module if it is not loaded. Resolves: #3326 Signed-off-by: Nikhil Kshirsagar --- sos/report/plugins/ubuntu.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sos/report/plugins/ubuntu.py b/sos/report/plugins/ubuntu.py index 9fc3c3a18a..a6b1d6d37e 100644 --- a/sos/report/plugins/ubuntu.py +++ b/sos/report/plugins/ubuntu.py @@ -6,7 +6,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, UbuntuPlugin +from sos.report.plugins import Plugin, UbuntuPlugin, SoSPredicate from sos.utilities import is_executable @@ -30,8 +30,11 @@ def setup(self): ua_tools_status = 'pro status' else: ua_tools_status = 'ubuntu-advantage status' - self.add_cmd_output(ua_tools_status) - self.add_cmd_output("%s --format json" % ua_tools_status) + ua_pred = SoSPredicate(self, kmods=['tls']) + self.add_cmd_output(ua_tools_status, + pred=ua_pred, changes=True) + self.add_cmd_output("%s --format json" % ua_tools_status, + pred=ua_pred, changes=True) if not self.get_option("all_logs"): self.add_copy_spec([