Compare commits

...

10 Commits

Author SHA1 Message Date
3b03cb9eca import UBI sos-4.7.2-2.el8_10 2024-08-28 01:10:07 +00:00
a38c3757d0 import UBI sos-4.7.1-3.el8_10 2024-06-24 01:32:19 +00:00
8e4ba32c9a import CS sos-4.7.1-2.el8 2024-05-22 13:48:34 +00:00
2b6c5de85d import UBI sos-4.7.0-1.el8 2024-04-10 01:33:18 +00:00
eabdullin
cce1af82c4 import UBI sos-4.6.1-1.el8 2024-02-07 19:23:16 +00:00
eabdullin
157c2d14d2 import UBI sos-4.6.0-5.el8 2023-11-02 20:04:13 +00:00
eabdullin
61cc2ee9bf import UBI sos-4.6.0-2.el8 2023-09-26 14:34:49 +00:00
eabdullin
e3bb8bf563 import UBI sos-4.5.6-1.el8 2023-08-30 21:24:25 +00:00
fb09e4e130 import UBI sos-4.5.5-2.el8 2023-07-26 14:06:12 +00:00
d3882c8950 import CS sos-4.5.4-1.el8 2023-06-28 15:16:57 +00:00
4 changed files with 156 additions and 5 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
SOURCES/sos-4.5.3.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 @@
eec8ce79aa42dd6561bce9638c8e803e9f81e476 SOURCES/sos-4.5.3.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

@ -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.5.3 Version: 4.7.2
Release: 1%{?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
@ -16,12 +16,13 @@ BuildRequires: python3-devel
BuildRequires: gettext BuildRequires: gettext
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
Requires: python3-requests Requires: python3-requests
Requires: python3-setuptools
Recommends: python3-magic Recommends: python3-magic
Recommends: python3-pexpect Recommends: python3-pexpect
Recommends: python3-pyyaml Recommends: python3-pyyaml
Conflicts: vdsm < 4.40 Conflicts: vdsm < 4.40
Obsoletes: sos-collector Obsoletes: sos-collector
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
@ -32,6 +33,7 @@ support technicians and developers.
%prep %prep
%setup -qn %{name}-%{version} %setup -qn %{name}-%{version}
%setup -T -D -a1 -q %setup -T -D -a1 -q
%patch0 -p1 -R
%build %build
@ -105,6 +107,78 @@ 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
- [archive] Fix get_archive_root after files reordering
Resolves: RHEL-35945
* Mon Apr 08 2024 Jan Jansky <jjansky@redhat.com> = 4.7.1-1
- rebase to upstream 4.7.1
Resolves: RHEL-32104
* Tue Feb 20 2024 Jan Jansky <jjansky@redhat.com> = 4.7.0-1
- rebase to upstream 4.7.0
Resolves: RHEL-26111
* Thu Jan 11 2024 Pavel Moravec <pmoravec@redhat.com> = 4.6.1-1
- rebase to upstream 4.6.1
Resolves: RHEL-21173
- [redhat] Change authentication method for RHEL
Resolves: RHEL-21177
* Wed Oct 18 2023 Pavel Moravec <pmoravec@redhat.com> = 4.6.0-5
[pulpcore] Scrub AUTH_LDAP_BIND_PASSWORD value
Resolves: RHEL-13697
* Tue Oct 17 2023 Pavel Moravec <pmoravec@redhat.com> = 4.6.0-4
- [pulp] Fix dynaconf obfuscation and add AUTH_LDAP_BIND_PASSWORD
Resolves: RHEL-13697
* Fri Sep 01 2023 Pavel Moravec <pmoravec@redhat.com> = 4.6.0-2
- [openshift_ovn] Collect additional ovnkube node logs
Resolves: SUPDEV145
* Wed Aug 23 2023 Jan Jansky <jjansky@redhat.com> = 4.6.0-1
- [cleaner] Use data filter for extraction
Resolves: bz2218873
* Thu Jul 27 2023 Pavel Moravec <pmoravec@redhat.com> = 4.5.6-1
- Rebase sos to 4.5.6
Resolves: bz2226724
* Fri Jul 14 2023 Jan Jansky <jjansky@redhat.com> = 4.5.5-2
- Adding patch for mac obfuscation
Resolves: bz2218279
Resolves: bz2216608
Resolves: bz2207562
* Mon Jul 03 2023 Jan Jansky <jjansky@redhat.com> = 4.5.5-1
- [clean] Respect permissions of sanitised files
Resolves: bz2218279
- [plugin] Fix exception when calling os.makedirs
Resolves: bz2216608
- [cleaner] Enhance trailing characters list after AMC address
Resolves: bz2207562
* Thu Jun 01 2023 Pavel Moravec <pmoravec@redhat.com> = 4.5.4-1
- [plugins] collect strings before commands
Resolves: bz2203141
- [collector] collect report from primary node if in node_list
Resolves: bz2186460
- [powerpc] collect invscout logs
Resolves: bz2210543
- [rhc] New plugin for RHC
Resolves: bz2196649
* Fri May 05 2023 Jan Jansky <jjansky@redhat.com> = 4.5.3-1 * Fri May 05 2023 Jan Jansky <jjansky@redhat.com> = 4.5.3-1
- [report] Ignore case when scrubbing via do_file_sub - [report] Ignore case when scrubbing via do_file_sub
Resolves: bz2143272 Resolves: bz2143272