import UBI sos-4.7.2-2.el8_10

This commit is contained in:
eabdullin 2024-08-28 00:10:07 +00:00
parent a38c3757d0
commit 3b03cb9eca
5 changed files with 94 additions and 37 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
SOURCES/sos-4.7.1.tar.gz SOURCES/sos-4.7.2.tar.gz
SOURCES/sos-audit-0.3.tgz SOURCES/sos-audit-0.3.tgz

View File

@ -1,2 +1,2 @@
9ced981872d308e13c5dc47fee21071592ceefc2 SOURCES/sos-4.7.1.tar.gz e01a25f05322cf56b75e07b5102dd61dbd4f0869 SOURCES/sos-4.7.2.tar.gz
9d478b9f0085da9178af103078bbf2fd77b0175a SOURCES/sos-audit-0.3.tgz 9d478b9f0085da9178af103078bbf2fd77b0175a SOURCES/sos-audit-0.3.tgz

View File

@ -0,0 +1,77 @@
From 11879fbb1adc33d8abc0cb70dc63e7e88c39fc3f Mon Sep 17 00:00:00 2001
From: Jose Castillo <jcastillo@redhat.com>
Date: Wed, 21 Feb 2024 12:24:37 +0000
Subject: [PATCH] [redhat|policy] Check for archive size before upload
The Red Hat Customer Portal has a max limit for
single http requests of 1Gb. From sos side, we never checked this
and so customers had to wait for the whole upload to be attempted
before receiving an error from the portal.
This patch attempts to stop the upload before it starts, informing
customers of such limit, and switching to secure FTP where there's
no limit.
Related: RHEL-22732
Signed-off-by: Jose Castillo <jcastillo@redhat.com>
---
sos/policies/distros/redhat.py | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/sos/policies/distros/redhat.py b/sos/policies/distros/redhat.py
index edea151e2..2fb0df3fa 100644
--- a/sos/policies/distros/redhat.py
+++ b/sos/policies/distros/redhat.py
@@ -22,7 +22,7 @@
from sos.policies.package_managers.rpm import RpmPackageManager
from sos.policies.package_managers.flatpak import FlatpakPackageManager
from sos.policies.package_managers import MultiPackageManager
-from sos.utilities import bold
+from sos.utilities import bold, convert_bytes
from sos import _sos as _
try:
@@ -232,6 +232,8 @@ class RHELPolicy(RedHatPolicy):
_upload_url = RH_SFTP_HOST
_upload_method = 'post'
_device_token = None
+ # Max size for an http single request is 1Gb
+ _max_size_request = 1073741824
def __init__(self, sysroot=None, init=None, probe_runtime=True,
remote_exec=None):
@@ -429,15 +429,30 @@ support representative.
return super().upload_sftp(user=_user, password=_token)
raise Exception("Could not retrieve valid or anonymous credentials")
+ def check_file_too_big(self, archive):
+ size = os.path.getsize(archive)
+ # Lets check if the size is bigger than the limit.
+ # There's really no need to transform the size to Gb,
+ # so we don't need to call any size converter implemented
+ # in tools.py
+ if (size >= self._max_size_request):
+ self.ui_log.warning(
+ _("Size of archive is bigger than Red Hat Customer Portal "
+ "limit for uploads of "
+ f"{convert_bytes(self._max_size_request)} "
+ " via sos http upload. \n")
+ )
+ return RH_SFTP_HOST
+ else:
+ return RH_API_HOST
+
def upload_archive(self, archive):
"""Override the base upload_archive to provide for automatic failover
from RHCP failures to the public RH dropbox
"""
try:
- if self.upload_url and self.upload_url.startswith(RH_API_HOST) and\
- (not self.get_upload_user() or
- not self.get_upload_password()):
- self.upload_url = RH_SFTP_HOST
+ if self.get_upload_url().startswith(RH_API_HOST):
+ self.upload_url = self.check_file_too_big(archive)
uploaded = super().upload_archive(archive)
except Exception as e:
uploaded = False

View File

@ -1,30 +0,0 @@
From a0c2586e230c9600d3d3f70ab89c9f6eb52ed3ed Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Tue, 23 Apr 2024 11:00:11 +0200
Subject: [PATCH] [archive] Fix get_archive_root after files reordering
Commit d5d8c21 reordered files in the archive, such that the first
member is not the archive root directory further more. Let change the
get_archive_root method accordingly to prevent self.archive_root being
empty.
Resolves: #3616
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
---
sos/cleaner/archives/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sos/cleaner/archives/__init__.py b/sos/cleaner/archives/__init__.py
index f7c5eb587..0fa1ef43f 100644
--- a/sos/cleaner/archives/__init__.py
+++ b/sos/cleaner/archives/__init__.py
@@ -104,7 +104,7 @@ def get_archive_root(self):
if toplevel.isdir():
return toplevel.name
else:
- return os.sep
+ return os.path.dirname(toplevel.name) or os.sep
return os.path.abspath(self.archive_path)
def report_msg(self, msg):

View File

@ -4,8 +4,8 @@
Summary: A set of tools to gather troubleshooting information from a system Summary: A set of tools to gather troubleshooting information from a system
Name: sos Name: sos
Version: 4.7.1 Version: 4.7.2
Release: 3%{?dist} Release: 2%{?dist}
Group: Applications/System Group: Applications/System
Source0: https://github.com/sosreport/sos/archive/%{version}/sos-%{version}.tar.gz Source0: https://github.com/sosreport/sos/archive/%{version}/sos-%{version}.tar.gz
Source1: sos-audit-%{auditversion}.tgz Source1: sos-audit-%{auditversion}.tgz
@ -22,7 +22,7 @@ Recommends: python3-pexpect
Recommends: python3-pyyaml Recommends: python3-pyyaml
Conflicts: vdsm < 4.40 Conflicts: vdsm < 4.40
Obsoletes: sos-collector Obsoletes: sos-collector
Patch1: sos-RHEL-35945-sos-clean-on-archive.patch Patch0: sos-RHEL-22732-reverted.patch
%description %description
Sos is a set of tools that gathers information about system Sos is a set of tools that gathers information about system
@ -33,11 +33,11 @@ support technicians and developers.
%prep %prep
%setup -qn %{name}-%{version} %setup -qn %{name}-%{version}
%setup -T -D -a1 -q %setup -T -D -a1 -q
%patch1 -p1 %patch0 -p1 -R
%build %build
%py3_build %py3_build
%install %install
%py3_install '--install-scripts=%{_sbindir}' %py3_install '--install-scripts=%{_sbindir}'
@ -107,6 +107,16 @@ of the system. Currently storage and filesystem commands are audited.
%ghost /etc/audit/rules.d/40-sos-storage.rules %ghost /etc/audit/rules.d/40-sos-storage.rules
%changelog %changelog
* Wed Aug 21 2024 Pavel Moravec <pmoravec@redhat.com> = 4.7.2-2
- reverting RHEL-22732 patch due to regressions
Resolves: RHEL-49779
* Fri Jun 21 2024 Pierguido Lambri <plambri@redhat.com> = 4.7.2-1
- New upstream release
Resolves: RHEL-40871
Resolves: RHEL-33703
Resolves: RHEL-22732
* Thu May 09 2024 Pavel Moravec <pmoravec@redhat.com> = 4.7.1-3 * Thu May 09 2024 Pavel Moravec <pmoravec@redhat.com> = 4.7.1-3
- [archive] Fix get_archive_root after files reordering - [archive] Fix get_archive_root after files reordering
Resolves: RHEL-35945 Resolves: RHEL-35945