From 782889258497025e84a28cd14834ce1d9a6dbfbd Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Sat, 27 Apr 2024 10:29:36 -0400 Subject: [CodeQL] Resolve remaining alerts from CodeQL scans Resolve the remaining handful of alerts from CodeQL, while others have been manually dimissed after review. Signed-off-by: Jake Hunsaker --- sos/cleaner/mappings/hostname_map.py | 2 +- sos/collector/__init__.py | 2 +- sos/policies/__init__.py | 2 +- sos/presets/redhat/__init__.py | 2 -- sos/report/__init__.py | 1 - sos/report/plugins/ssh.py | 1 + 6 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sos/cleaner/mappings/hostname_map.py b/sos/cleaner/mappings/hostname_map.py index 659ba4af..a0a85418 100644 --- a/sos/cleaner/mappings/hostname_map.py +++ b/sos/cleaner/mappings/hostname_map.py @@ -156,7 +156,7 @@ class SoSHostnameMap(SoSMap): # try to account for use of '-' in names that include hostnames # and don't create new mappings for each of these for _existing in sorted(self.dataset.keys(), reverse=True, - key=lambda x: len(x)): + key=len): _host_substr = False _test = item.split(_existing) _h = _existing.split('.') diff --git a/sos/collector/__init__.py b/sos/collector/__init__.py index 7d63e5e9..4cdb10a2 100644 --- a/sos/collector/__init__.py +++ b/sos/collector/__init__.py @@ -241,7 +241,7 @@ class SoSCollector(SoSComponent): return modules @classmethod - def _import_modules(self, modname): + def _import_modules(cls, modname): """Import and return all found classes in a module""" mod_short_name = modname.split('.')[2] try: diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py index e13b0ff0..52f096ea 100644 --- a/sos/policies/__init__.py +++ b/sos/policies/__init__.py @@ -359,7 +359,7 @@ any third party. return "sha256" @classmethod - def display_help(self, section): + def display_help(cls, section): section.set_title('SoS Policies') section.add_text( 'Policies help govern how SoS operates on across different distri' diff --git a/sos/presets/redhat/__init__.py b/sos/presets/redhat/__init__.py index 2536dc0a..1fd749da 100644 --- a/sos/presets/redhat/__init__.py +++ b/sos/presets/redhat/__init__.py @@ -15,8 +15,6 @@ from sos.presets import PresetDefaults RHEL_RELEASE_STR = "Red Hat Enterprise Linux" _opts_verify = SoSOptions(verify=True) -_opts_all_logs = SoSOptions(all_logs=True) -_opts_all_logs_verify = SoSOptions(all_logs=True, verify=True) _cb_profiles = ['boot', 'storage', 'system'] _cb_plugopts = ['boot.all-images=on', 'rpm.rpmva=on', 'rpm.rpmdb=on'] diff --git a/sos/report/__init__.py b/sos/report/__init__.py index dde6ffd6..cf3d0d76 100644 --- a/sos/report/__init__.py +++ b/sos/report/__init__.py @@ -146,7 +146,6 @@ class SoSReport(SoSComponent): self.skipped_plugins = [] self.all_options = [] self.env_vars = set() - self.archive = None self._args = args self.sysroot = "/" self.estimated_plugsizes = {} diff --git a/sos/report/plugins/ssh.py b/sos/report/plugins/ssh.py index 10a624cb..17d7606b 100644 --- a/sos/report/plugins/ssh.py +++ b/sos/report/plugins/ssh.py @@ -99,6 +99,7 @@ class Ssh(Plugin, IndependentPlugin): if self.path_isdir(home_dir): self.add_cmd_output(f"ls -laZ {home_dir}") except IndexError: + # invalid line for home dir parsing, ignore pass # vim: set et ts=4 sw=4 : -- cgit