From fba5d1ff9ec4a1ab020858733b42b17c4476af68 Mon Sep 17 00:00:00 2001 From: Pierguido Lambri Date: Mon, 9 Sep 2024 22:03:12 +0100 Subject: [PATCH] sos updates to 9.4.z Resolves: RHEL-58096 Signed-off-by: Pierguido Lambri --- .gitignore | 1 + sos-RHEL-22732-reverted.patch | 77 ----------------------------------- sos.spec | 10 +++-- sources | 2 +- 4 files changed, 8 insertions(+), 82 deletions(-) delete mode 100644 sos-RHEL-22732-reverted.patch diff --git a/.gitignore b/.gitignore index 7856a21..033fa91 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ sos-2.2.tar.gz /sos-4.7.0.tar.gz /sos-4.7.1.tar.gz /sos-4.7.2.tar.gz +/sos-4.8.0.tar.gz diff --git a/sos-RHEL-22732-reverted.patch b/sos-RHEL-22732-reverted.patch deleted file mode 100644 index 2738138..0000000 --- a/sos-RHEL-22732-reverted.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 11879fbb1adc33d8abc0cb70dc63e7e88c39fc3f Mon Sep 17 00:00:00 2001 -From: Jose Castillo -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 ---- - 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 diff --git a/sos.spec b/sos.spec index 9874191..15d44c3 100644 --- a/sos.spec +++ b/sos.spec @@ -4,8 +4,8 @@ Summary: A set of tools to gather troubleshooting information from a system Name: sos -Version: 4.7.2 -Release: 3%{?dist} +Version: 4.8.0 +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 -Patch0: sos-RHEL-22732-reverted.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 -%patch0 -p1 -R %build %py3_build @@ -106,6 +104,10 @@ of the system. Currently storage and filesystem commands are audited. %changelog +* Mon Sep 09 2024 Pierguido Lambri = 4.8.0-1 +- New upstream release + Resolves: RHEL-58096 + * Wed Aug 21 2024 Pavel Moravec = 4.7.2-3 - reverting RHEL-22732 patch due to regressions Resolves: RHEL-49781 diff --git a/sources b/sources index 47fffc0..b8d1e99 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (sos-4.7.2.tar.gz) = 00124fcd1b14a16213ddd53da9686c4efcb773321e5e6e4a2c883bbe71e8ea200055134404942140a55bd94a3aeec272c5bc296f73b5bf16c7194955442e40e6 +SHA512 (sos-4.8.0.tar.gz) = d0874794d015e07cbd57ddf7f6092c8f61b8fb866abc34073c1c865353acdb1df37290aa99431e41f6c863fe6b04c16488c6ee748aba55ec81d90efd8543ad92 SHA512 (sos-audit-0.3.tgz) = 32597baf6350804d08179a0dbe48470a93df148e83d2e49bb3288f6bcc2d151bb1433761913bfbccd912c14de92435939fef5bcd7e091dfe33a345d61ea842ea