From 71a6d2719a48bd1803229bbdd8d261b748e9c28d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jun 28 2022 07:53:15 +0000 Subject: import sos-3.9-5.el7_9.11 --- diff --git a/SOURCES/sos-bz2043103-collect_decoded_dynflow_data.patch b/SOURCES/sos-bz2043103-collect_decoded_dynflow_data.patch new file mode 100644 index 0000000..3fad7c5 --- /dev/null +++ b/SOURCES/sos-bz2043103-collect_decoded_dynflow_data.patch @@ -0,0 +1,61 @@ +From 5f95c24ccd3224d441eb1dcab3e63c33847b18bb Mon Sep 17 00:00:00 2001 +From: Barbora Vassova +Date: Tue, 5 Apr 2022 13:01:33 +0200 +Subject: [PATCH] In dynflow >=1.6.3, dynflow* tables in postgres are encoded + by msgpack which makes plain CSV dumps unreadable. In such a case, + psql-msgpack-decode wrapper tool from dynflow-utils (of any version) must be + used instead of the plain psql command. + +Resolves: #2900 + +Signed-off-by: Barbora Vassova +--- + sos/plugins/foreman.py | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +diff --git a/sos/plugins/foreman.py b/sos/plugins/foreman.py +index c742ebcab..e0b6eeb15 100644 +--- a/sos/plugins/foreman.py ++++ b/sos/plugins/foreman.py +@@ -244,15 +244,23 @@ def setup(self): + self.add_cmd_output(_cmd, suggest_filename=table, timeout=600, + sizelimit=100, env=self.env) + ++ # dynflow* tables on dynflow >=1.6.3 are encoded and hence in that ++ # case, psql-msgpack-decode wrapper tool from dynflow-utils (any ++ # version) must be used instead of plain psql command ++ dynutils = self.is_installed('dynflow-utils') + for dyn in foremancsv: +- _cmd = self.build_query_cmd(foremancsv[dyn], csv=True) ++ binary = "psql" ++ if dyn != 'foreman_tasks_tasks' and dynutils: ++ binary = "/usr/libexec/psql-msgpack-decode" ++ _cmd = self.build_query_cmd(foremancsv[dyn], csv=True, ++ binary=binary) + self.add_cmd_output(_cmd, suggest_filename=dyn, timeout=600, + sizelimit=100, env=self.env) + + # collect http[|s]_proxy env.variables + self.add_env_var(["http_proxy", "https_proxy"]) + +- def build_query_cmd(self, query, csv=False): ++ def build_query_cmd(self, query, csv=False, binary="psql"): + """ + Builds the command needed to invoke the pgsql query as the postgres + user. +@@ -260,10 +268,11 @@ def build_query_cmd(self, query, csv=False): + shell and postgres parsing requirements. Note that this will generate + a large amount of quoting in sos logs referencing the command being run + """ +- csvformat = "-A -F , -X" if csv else "" +- _dbcmd = "psql --no-password -h %s -p 5432 -U foreman -d foreman %s \ +- -c %s" +- return _dbcmd % (self.dbhost, csvformat, quote(query)) ++ if csv: ++ query = "COPY (%s) TO STDOUT " \ ++ "WITH (FORMAT 'csv', DELIMITER ',', HEADER)" % query ++ _dbcmd = "%s --no-password -h %s -p 5432 -U foreman -d foreman -c %s" ++ return _dbcmd % (binary, self.dbhost, quote(query)) + + def postproc(self): + satreg = r"((foreman.*)?(\"::(foreman(.*?)|katello).*)?((::(.*)::.*" \ diff --git a/SOURCES/sos-centos-branding.patch b/SOURCES/sos-centos-branding.patch deleted file mode 100644 index 3c49fa2..0000000 --- a/SOURCES/sos-centos-branding.patch +++ /dev/null @@ -1,162 +0,0 @@ -diff -uNrp sos-3.9.orig/sos/policies/redhat.py sos-3.9/sos/policies/redhat.py ---- sos-3.9.orig/sos/policies/redhat.py 2020-03-24 15:33:13.000000000 +0000 -+++ sos-3.9/sos/policies/redhat.py 2020-10-03 12:48:32.088747085 +0000 -@@ -89,7 +89,7 @@ class RedHatPolicy(LinuxPolicy): - def check(cls): - """This method checks to see if we are running on Red Hat. It must be - overriden by concrete subclasses to return True when running on a -- Fedora, RHEL or other Red Hat distribution or False otherwise.""" -+ Fedora, CentOS, RHEL or other Red Hat distribution or False otherwise.""" - return False - - def check_usrmove(self, pkgs): -@@ -187,29 +187,29 @@ _opts_all_logs_verify = SoSOptions(all_l - _cb_profiles = ['boot', 'storage', 'system'] - _cb_plugopts = ['boot.all-images=on', 'rpm.rpmva=on', 'rpm.rpmdb=on'] - --RHEL_RELEASE_STR = "Red Hat Enterprise Linux" -+RHEL_RELEASE_STR = "CentOS Linux" - - RHV = "rhv" --RHV_DESC = "Red Hat Virtualization" -+RHV_DESC = "Virtualization" - - RHEL = "rhel" - RHEL_DESC = RHEL_RELEASE_STR - - RHOSP = "rhosp" --RHOSP_DESC = "Red Hat OpenStack Platform" -+RHOSP_DESC = "OpenStack Platform" - - RHOCP = "ocp" --RHOCP_DESC = "OpenShift Container Platform by Red Hat" -+RHOCP_DESC = "OpenShift Container Platform" - RHOSP_OPTS = SoSOptions(plugopts=[ - 'process.lsof=off', - 'networking.ethtool_namespaces=False', - 'networking.namespaces=200']) - - RH_CFME = "cfme" --RH_CFME_DESC = "Red Hat CloudForms" -+RH_CFME_DESC = "CloudForms" - - RH_SATELLITE = "satellite" --RH_SATELLITE_DESC = "Red Hat Satellite" -+RH_SATELLITE_DESC = "Satellite" - SAT_OPTS = SoSOptions(verify=True, plugopts=['apache.log=on']) - - CB = "cantboot" -@@ -257,8 +257,8 @@ RH_FTP_HOST = "ftp://dropbox.redhat.com" - - class RHELPolicy(RedHatPolicy): - distro = RHEL_RELEASE_STR -- vendor = "Red Hat" -- vendor_url = "https://access.redhat.com/support/" -+ vendor = "CentOS" -+ vendor_url = "https://wiki.centos.org/support" - msg = _("""\ - This command will collect diagnostic and configuration \ - information from this %(distro)s system and installed \ -@@ -280,7 +280,7 @@ support representative. - def check(cls): - """Test to see if the running host is a RHEL installation. - -- Checks for the presence of the "Red Hat Enterprise Linux" -+ Checks for the presence of the "CentOS Linux" - release string at the beginning of the NAME field in the - `/etc/os-release` file and returns ``True`` if it is - found, and ``False`` otherwise. -@@ -389,7 +389,7 @@ class CentOsPolicy(RHELPolicy): - - ATOMIC = "atomic" - ATOMIC_RELEASE_STR = "Atomic" --ATOMIC_DESC = "Red Hat Enterprise Linux Atomic Host" -+ATOMIC_DESC = "Atomic Host" - - atomic_presets = { - ATOMIC: PresetDefaults(name=ATOMIC, desc=ATOMIC_DESC, note=NOTE_TIME, -@@ -398,7 +398,7 @@ atomic_presets = { - - - class RedHatAtomicPolicy(RHELPolicy): -- distro = "Red Hat Atomic Host" -+ distro = "Atomic Host" - msg = _("""\ - This command will collect diagnostic and configuration \ - information from this %(distro)s system. -@@ -435,7 +435,7 @@ support representative. - - - class RedHatCoreOSPolicy(RHELPolicy): -- distro = "Red Hat CoreOS" -+ distro = "CoreOS" - msg = _("""\ - This command will collect diagnostic and configuration \ - information from this %(distro)s system. -@@ -456,7 +456,7 @@ support representative. - host_release = os.environ[ENV_HOST_SYSROOT] + cls._redhat_release - try: - for line in open(host_release, 'r').read().splitlines(): -- coreos |= 'Red Hat CoreOS' in line -+ coreos |= 'CoreOS' in line - except IOError: - pass - return coreos -diff -uNrp sos-3.9.orig/sos/policies/redhat.py sos-3.9/sos/policies/redhat.py ---- sos-3.9.orig/sos/policies/redhat.py 2021-02-02 15:39:49.180326048 +0000 -+++ sos-3.9/sos/policies/redhat.py 2021-02-02 15:44:02.907874181 +0000 -@@ -31,9 +31,9 @@ except NameError: - - - class RedHatPolicy(LinuxPolicy): -- distro = "Red Hat" -- vendor = "Red Hat" -- vendor_url = "https://www.redhat.com/" -+ distro = "CentOS" -+ vendor = "CentOS" -+ vendor_url = "https://www.centos.org/" - _redhat_release = '/etc/redhat-release' - _tmp_dir = "/var/tmp" - _rpmq_cmd = 'rpm -qa --queryformat "%{NAME}|%{VERSION}|%{RELEASE}\\n"' -@@ -87,9 +87,9 @@ class RedHatPolicy(LinuxPolicy): - - @classmethod - def check(cls): -- """This method checks to see if we are running on Red Hat. It must be -+ """This method checks to see if we are running on CentOS Linux. It must be - overriden by concrete subclasses to return True when running on a -- Fedora, CentOS, RHEL or other Red Hat distribution or False otherwise.""" -+ Fedora, CentOS, RHEL or other CentOS distribution or False otherwise.""" - return False - - def check_usrmove(self, pkgs): -diff -uNrp sos-3.9.orig/sos/policies/redhat.py sos-3.9/sos/policies/redhat.py ---- sos-3.9.orig/sos/policies/redhat.py 2022-02-23 17:25:33.120951926 +0000 -+++ sos-3.9/sos/policies/redhat.py 2022-02-23 17:27:58.698344937 +0000 -@@ -313,7 +313,7 @@ support representative. - return - if self.case_id: - self.upload_user = input(_( -- "Enter your Red Hat Customer Portal username for uploading [" -+ "Enter your Customer Portal username for uploading [" - "empty for anonymous SFTP]: ") - ) - -@@ -335,7 +335,7 @@ support representative. - - def get_upload_url_string(self): - if self.get_upload_url().startswith(RH_API_HOST): -- return "Red Hat Customer Portal" -+ return "Customer Portal" - elif self.get_upload_url().startswith(RH_SFTP_HOST): - return "Red Hat Secure FTP" - return self.upload_url -@@ -403,7 +403,7 @@ support representative. - if not self.upload_url.startswith(RH_API_HOST): - raise - else: -- print("Upload to Red Hat Customer Portal failed. Trying %s" -+ print("Upload to Customer Portal failed. Trying %s" - % RH_SFTP_HOST) - self.upload_url = RH_SFTP_HOST - uploaded = super(RHELPolicy, self).upload_archive(archive) diff --git a/SPECS/sos.spec b/SPECS/sos.spec index 03ffb0e..7048a18 100644 --- a/SPECS/sos.spec +++ b/SPECS/sos.spec @@ -3,7 +3,7 @@ Summary: A set of tools to gather troubleshooting information from a system Name: sos Version: 3.9 -Release: 5%{?dist}.10 +Release: 5%{?dist}.11 Group: Applications/System Source0: https://github.com/sosreport/sos/archive/%{version}.tar.gz License: GPLv2+ @@ -56,7 +56,7 @@ Patch32: sos-bz1964000-foreman-follow-sizelimit-to-foreman-maintain-and-installe Patch33: sos-bz1946641-sssd-plugin-when-sssd-common.patch Patch34: sos-bz1959781-migrationresults-new-plugin.patch Patch35: sos-bz2011337-dropbox-to-sftp.patch -Patch36: sos-centos-branding.patch +Patch36: sos-bz2043103-collect_decoded_dynflow_data.patch %description Sos is a set of tools that gathers information about system @@ -126,8 +126,9 @@ rm -rf ${RPM_BUILD_ROOT} %config(noreplace) %{_sysconfdir}/sos.conf %changelog -* Tue Feb 22 2022 CentOS Sources - 3.9-5.el7.centos.10 -- Roll in CentOS Branding +* Wed Apr 06 2022 Barbora Vassova = 3.9-5.11 +- [foreman] Use psql-msgpack-decode wrapper for dynflow >= 1.6 + Resolves: bz2043103 * Fri Jan 07 2022 Barbora Vassova