Update to 4.9.1 in RHEL 10

Resolves: RHEL-86667
Resolves: RHEL-86651

Signed-off-by: Jan Jansky <jjansky@redhat.com>
This commit is contained in:
Jan Jansky 2025-04-15 14:34:15 +02:00
parent 96c98ac225
commit fe0f93c9f8
4 changed files with 14 additions and 153 deletions

2
.gitignore vendored
View File

@ -30,3 +30,5 @@ sos-2.2.tar.gz
/sos-4.8.0.tar.gz
/sos-4.8.1.tar.gz
/sos-4.8.2.tar.gz
/sos-4.9.1.tar.gz
/sos-audit-0.3-1.tgz

View File

@ -1,143 +0,0 @@
From 8fb859dea4366ac446fab1855ce3a163e6312d25 Mon Sep 17 00:00:00 2001
From: Nagoor Shaik <nshaik@redhat.com>
Date: Thu, 2 Jan 2025 10:05:24 +0530
Subject: [PATCH] added new AAP Containerized plugin
Signed-off-by: Nagoor Shaik <nshaik@redhat.com>
---
sos/report/plugins/aap_containerized.py | 123 ++++++++++++++++++++++++
1 file changed, 123 insertions(+)
create mode 100644 sos/report/plugins/aap_containerized.py
diff --git a/sos/report/plugins/aap_containerized.py b/sos/report/plugins/aap_containerized.py
new file mode 100644
index 00000000..543104d3
--- /dev/null
+++ b/sos/report/plugins/aap_containerized.py
@@ -0,0 +1,123 @@
+# Copyright (c) 2025 Nagoor Shaik <nshaik@redhat.com>
+
+# This file is part of the sos project: https://github.com/sosreport/sos
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# version 2 of the GNU General Public License.
+#
+# See the LICENSE file in the source distribution for further information.
+
+import os
+from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt
+
+
+class AAPContainerized(Plugin, RedHatPlugin):
+ """Collects details about AAP Containerized setup
+ under a user's home directory"""
+
+ short_desc = "AAP Containerized Setup"
+ plugin_name = "aap_containerized"
+ profiles = ("sysmgmt", "ansible",)
+ packages = ("podman",)
+
+ option_list = [
+ PluginOpt(
+ "username",
+ default="",
+ val_type=str,
+ desc="Username that was used to setup "
+ "AAP containerized installation"
+ ),
+ PluginOpt(
+ "directory",
+ default="",
+ val_type=str,
+ desc="Absolute path to AAP containers volume directory. "
+ "Defaults to 'aap' under provided user's home directory"
+ )
+ ]
+
+ def setup(self):
+ # Check if username is passed as argument
+ username = self.get_option("username")
+ if not username:
+ self._log_error("Username is mandatory to collect "
+ "AAP containerized setup logs")
+ return
+
+ # Grab aap installation directory under user's home
+ if not self.get_option("directory"):
+ user_home_directory = os.path.expanduser(f"~{username}")
+ aap_directory_name = self.path_join(user_home_directory, "aap")
+ else:
+ aap_directory_name = self.get_option("directory")
+
+ # Don't collect cert and key files from the installation directory
+ if self.path_exists(aap_directory_name):
+ forbidden_paths = [
+ self.path_join(aap_directory_name, path)
+ for path in [
+ "containers",
+ "tls",
+ "controller/etc/*.cert",
+ "controller/etc/*.key",
+ "eda/etc/*.cert",
+ "eda/etc/*.key",
+ "gateway/etc/*.cert",
+ "gateway/etc/*.key",
+ "hub/etc/*.cert",
+ "hub/etc/*.key",
+ "hub/etc/keys/*.pem",
+ "postgresql/*.crt",
+ "postgresql/*.key",
+ "receptor/etc/*.crt",
+ "receptor/etc/*.key",
+ "receptor/etc/*.pem",
+ "redis/*.crt",
+ "redis/*.key",
+ ]
+ ]
+ self.add_forbidden_path(forbidden_paths)
+ self.add_copy_spec(aap_directory_name)
+ else:
+ self._log_error(f"Directory {aap_directory_name} does not exist "
+ "or invalid absolute path provided")
+
+ # Gather output of following podman commands as user
+ podman_commands = [
+ (f"su - {username} -c 'podman info --debug'", "podman_info"),
+ (f"su - {username} -c 'podman ps -a --format json'",
+ "podman_ps_all_json"),
+ ]
+
+ for command, filename in podman_commands:
+ self.add_cmd_output(command, suggest_filename=filename)
+
+ # Collect AAP container names
+ aap_containers = self._get_aap_container_names(username)
+
+ # Copy podman container log files in plugin sub directory
+ # under aap_containers_log
+ for container in aap_containers:
+ log_file = f"{container}.log"
+ self.add_cmd_output(
+ f"su - {username} -c 'podman logs {container}'",
+ suggest_filename=f"{log_file}",
+ subdir="aap_containers_log"
+ )
+
+ # Function to fetch podman container names
+ def _get_aap_container_names(self, username):
+ try:
+ cmd = f"su - {username} -c 'podman ps -a --format {{{{.Names}}}}'"
+ cmd_out = self.exec_cmd(cmd)
+ return cmd_out['output'].strip().split("\n")
+ except Exception:
+ self._log_error("Error retrieving Podman containers")
+ return []
+
+ # Check and enable plugin on a AAP Containerized host
+ def check_enabled(self):
+ ps = self.exec_cmd("ps --noheaders axco command")
+ return "awx-manage" in ps["output"] and "aap-gateway" in ps["output"]
--
2.47.1

View File

@ -1,11 +1,11 @@
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%global auditversion 0.3
%global auditversion 0.3-1
Summary: A set of tools to gather troubleshooting information from a system
Name: sos
Version: 4.8.2
Release: 2%{?dist}
Version: 4.9.1
Release: 1%{?dist}
Group: Applications/System
Source0: https://github.com/sosreport/sos/archive/%{version}/sos-%{version}.tar.gz
Source1: sos-audit-%{auditversion}.tgz
@ -22,7 +22,6 @@ Recommends: python3-pexpect
Recommends: python3-pyyaml
Conflicts: vdsm < 4.40
Obsoletes: sos-collector <= 1.9
Patch1: sos-RHEL-75977-new-plugin-aap_containerized.patch
%description
Sos is a set of tools that gathers information about system
@ -33,7 +32,6 @@ support technicians and developers.
%prep
%setup -qn %{name}-%{version}
%setup -T -D -a1 -q
%patch -P 1 -p1
%build
%py3_build
@ -62,8 +60,6 @@ cd ..
# %%files -f %%{name}.lang
%files
%{_sbindir}/sos
%{_sbindir}/sosreport
%{_sbindir}/sos-collector
#%dir /etc/sos/cleaner
%dir /etc/sos/presets.d
%dir /etc/sos/extras.d
@ -80,7 +76,7 @@ cd ..
%package audit
Summary: Audit use of some commands for support purposes
License: GPLv2+
License: GPL-2.0-or-later
Group: Application/System
%description audit
@ -103,9 +99,15 @@ of the system. Currently storage and filesystem commands are audited.
%{_mandir}/man8/sos-audit.sh.8.gz
%ghost /etc/audit/rules.d/40-sos-filesystem.rules
%ghost /etc/audit/rules.d/40-sos-storage.rules
%license LICENSE
%changelog
* Tue Apr 15 2025 Jan Jansky <jjansky@redhat.com> = 4.9.1-1
- Update to 4.9.1 in RHEL 10
Resolves: RHEL-86667
Resolves: RHEL-86651
* Fri Jan 24 2025 Jan Jansky <jjansky@redhat.com> = 4.8.2-2
- Add new plugin aap_containerized
Resolves: RHEL-75977

View File

@ -1,2 +1,2 @@
SHA512 (sos-4.8.2.tar.gz) = 1050f35e90723252821a7fe02d506f5a5a6c21a2f91fef80443d719b4dbb26563a761d1fb84cf40a19eeb267e1c1500514f21a8d0b5513db52d5ff0019ea32d8
SHA512 (sos-audit-0.3.tgz) = 32597baf6350804d08179a0dbe48470a93df148e83d2e49bb3288f6bcc2d151bb1433761913bfbccd912c14de92435939fef5bcd7e091dfe33a345d61ea842ea
SHA512 (sos-4.9.1.tar.gz) = 21b51f50f376689c19dae112ab0fe8a0e56dcef83bcfcf7e23f78033b1f87d4f7568a68948019f15bb546325f4b872b8ffae7e8f137896c5be22586c0eb5c85d
SHA512 (sos-audit-0.3-1.tgz) = 24c7bfec7e47a082ca1f2a96c5ad455c692d81dcc4339877de5bd324719609d91bc0ef6ddb95485fb75b81f90f8a7cc58370ada6f626c275bab36e9e2a409330