Fixing sosreport and sos-collector binary

Resolves: RHEL-121468

Signed-off-by: Jan Jansky <jjansky@redhat.com>
This commit is contained in:
Jan Jansky 2025-12-04 13:48:36 +01:00
parent 94724c927d
commit 4e5d0779fd
3 changed files with 77 additions and 15 deletions

View File

@ -1,19 +1,17 @@
--- /dev/null 2025-10-28 14:11:21.494784405 +0100
+++ sos-4.10.1/bin/sosreport 2025-11-24 11:32:54.957181080 +0100
@@ -0,0 +1,6 @@
+#!/usr/bin/python3
+msg = ("sosreport binary is deprecated, use 'sos report' instead")
+print(msg)
+sos report
--- /dev/null 2025-10-28 14:11:21.494784405 +0100
+++ sos-4.10.1/bin/sosreport 2025-12-04 08:46:53.277857061 +0100
@@ -0,0 +1,5 @@
+#!/bin/bash
+echo "sosreport binary is deprecated, use 'sos report' instead"
+exec sos report "$@"
+
+# vim:ts=4 et sw=4
--- /dev/null 2025-10-28 14:11:21.494784405 +0100
+++ sos-4.10.1/bin/sos-collector 2025-11-24 11:34:23.002478014 +0100
@@ -0,0 +1,6 @@
+#!/usr/bin/python3
+msg = ("sos-collector binary is deprecated, use 'sos collector' instead")
+print(msg)
+sos collector
--- /dev/null 2025-10-28 14:11:21.494784405 +0100
+++ sos-4.10.1/bin/sos-collector 2025-12-04 08:48:04.661880220 +0100
@@ -0,0 +1,5 @@
+#!/bin/bash
+echo "sos-collector binary is deprecated, use 'sos collector' instead"
+exec sos collector "$@"
+
+# vim:ts=4 et sw=4
--- sos-4.10.1/setup.py 2025-04-15 15:17:21.938635468 +0200

View File

@ -0,0 +1,58 @@
From d78e7000d0c91ba0b6b7a56fc931bce3094d0bc9 Mon Sep 17 00:00:00 2001
From: Frank Liang <xiliang@redhat.com>
Date: Wed, 3 Dec 2025 00:21:06 +0800
Subject: [PATCH] [plugin_aws]fix unable to get metadata in aws.py
- exec_cmd() cmd type is a str, cannot execute when
it is a list
- removed spaces after X-aws-ec2-metadata-token and
X-aws-ec2-metadata-token-ttl-seconds
Signed-off-by: Frank Liang <xiliang@redhat.com>
---
sos/report/plugins/aws.py | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/sos/report/plugins/aws.py b/sos/report/plugins/aws.py
index 602e88e4..ba819bed 100644
--- a/sos/report/plugins/aws.py
+++ b/sos/report/plugins/aws.py
@@ -41,21 +41,19 @@ class Aws(Plugin, IndependentPlugin):
# Try to get an IMDSv2 token
token_url = 'http://169.254.169.254/latest/api/token'
- token_cmd = [
- 'curl', '-sS', '-X', 'PUT', '-H',
- 'X-aws-ec2-metadata-token-ttl-seconds: 21600',
- token_url]
+ token_cmd = f'curl -sS -X PUT -H \
+ X-aws-ec2-metadata-token-ttl-seconds:21600 {token_url}'
try:
- token = self.exec_cmd(token_cmd, timeout=1)
+ token = self.exec_cmd(token_cmd, timeout=1)['output']
except Exception:
token = ''
# Add header only if token retrieval succeeded
- token_header = []
+ token_header = ''
if token:
- token_header = ['-H', f'X-aws-ec2-metadata-token: {token}']
+ token_header = f'-H X-aws-ec2-metadata-token:{token}'
# List of metadata paths we want to get
metadata_paths = [
@@ -73,7 +71,7 @@ class Aws(Plugin, IndependentPlugin):
meta_url = base_url + path
safe_name = path.replace('/', '_')
self.add_cmd_output(
- ['curl', '-sS'] + token_header + [meta_url],
+ f'curl -sS {token_header} {meta_url}',
suggest_filename=f'aws_metadata_{safe_name}.txt'
)
--
2.51.1

View File

@ -5,7 +5,7 @@
Summary: A set of tools to gather troubleshooting information from a system
Name: sos
Version: 4.10.1
Release: 1%{?dist}
Release: 2%{?dist}
Group: Applications/System
Source0: https://github.com/sosreport/sos/archive/%{version}/sos-%{version}.tar.gz
Source1: sos-audit-%{auditversion}.tgz
@ -28,6 +28,7 @@ Patch3: 0003-revert-PR4092.patch
Patch4: 0004-cleaner-rhel8.patch
Patch5: 0005-pulpcore-RFE-export-table-contents-as-CSV.patch
Patch6: 0006-cleaner-Mask-IPv6-addresses-with-trailing-or.patch
Patch7: 0007-plugin_aws-fix-unable-to-get-metadata-in-aws.py.patch
%description
Sos is a set of tools that gathers information about system
@ -44,6 +45,7 @@ support technicians and developers.
%patch -P 4 -p1
%patch -P 5 -p1
%patch -P 6 -p1
%patch -P 7 -p1
%build
%py3_build
@ -116,6 +118,10 @@ of the system. Currently storage and filesystem commands are audited.
%license LICENSE
%changelog
* Fri Dec 05 2025 Jan Jansky <jjansky@redhat.com> = 4.10.1-2
- Fixing sosreport and sos-collector binary
Resolves: RHEL-121468
* Tue Nov 25 2025 Jan Jansky <jjansky@redhat.com> = 4.10.1-1
- Update to 4.10.1-1
Resolves: RHEL-121468