From a02fb7f9a8d23e8bc1f8be4d979250a2652039c2 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 21 Jan 2020 17:49:34 -0500 Subject: [PATCH] import sos-collector-1.8-1.el8 --- .gitignore | 2 +- .sos-collector.metadata | 2 +- .../sos-collector-nested-container-fix.patch | 59 -------------- SOURCES/sos-collector-none-cluster-fix.patch | 30 -------- SOURCES/sos-collector-pexpect.patch | 30 -------- SOURCES/sos-collector-rhcos-image.patch | 29 ------- SOURCES/sos-collector-temp-location.patch | 76 +++++++++++++++++++ SPECS/sos-collector.spec | 19 +++-- 8 files changed, 87 insertions(+), 160 deletions(-) delete mode 100644 SOURCES/sos-collector-nested-container-fix.patch delete mode 100644 SOURCES/sos-collector-none-cluster-fix.patch delete mode 100644 SOURCES/sos-collector-pexpect.patch delete mode 100644 SOURCES/sos-collector-rhcos-image.patch create mode 100644 SOURCES/sos-collector-temp-location.patch diff --git a/.gitignore b/.gitignore index 8766018..ae69df5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/sos-collector-1.7.tar.gz +SOURCES/sos-collector-1.8.tar.gz diff --git a/.sos-collector.metadata b/.sos-collector.metadata index 76bf747..7053a52 100644 --- a/.sos-collector.metadata +++ b/.sos-collector.metadata @@ -1 +1 @@ -5a4f3d843e90ac35af70c2da2e1b18a62df036c3 SOURCES/sos-collector-1.7.tar.gz +32b09cbab87d66d8b19f95db977c29f0fb828202 SOURCES/sos-collector-1.8.tar.gz diff --git a/SOURCES/sos-collector-nested-container-fix.patch b/SOURCES/sos-collector-nested-container-fix.patch deleted file mode 100644 index 0c33ae7..0000000 --- a/SOURCES/sos-collector-nested-container-fix.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0bc831a07be6ae837cb9029943c57255c47b647f Mon Sep 17 00:00:00 2001 -From: Jake Hunsaker -Date: Tue, 9 Apr 2019 12:59:03 -0400 -Subject: [PATCH] [sosnode] Don't create a container if we're in a container - -If sos-collector is being launched from a container on a containerized -host, we could potentially attempt to create a nested container. - -This change means we treat a sos-collector run that is already in a -container as a "normal" host and don't attempt the containerized bits. - -Signed-off-by: Jake Hunsaker ---- - soscollector/sosnode.py | 19 ++++++++++++++++++- - 1 file changed, 18 insertions(+), 1 deletion(-) - -diff --git a/soscollector/sosnode.py b/soscollector/sosnode.py -index a040244..405d05d 100644 ---- a/soscollector/sosnode.py -+++ b/soscollector/sosnode.py -@@ -68,10 +68,14 @@ class SosNode(): - self.connected = False - self.close_ssh_session() - return None -+ if self.local: -+ if self.check_in_container(): -+ self.host.containerized = False - self.log_debug("Host facts found to be %s" % - self.host.report_facts()) - self.get_hostname() -- self.create_sos_container() -+ if self.host.containerized: -+ self.create_sos_container() - self._load_sos_info() - - def _create_ssh_command(self): -@@ -84,6 +88,19 @@ class SosNode(): - return '{:<{}} : {}'.format(self._hostname, self.config['hostlen'] + 1, - msg) - -+ def check_in_container(self): -+ ''' -+ Tries to identify if we are currently running in a container or not. -+ ''' -+ if os.path.exists('/run/.containerenv'): -+ self.log_debug('Found /run/.containerenv. Running in container.') -+ return True -+ if os.environ.get('container') is not None: -+ self.log_debug("Found env var 'container'. Running in container") -+ return True -+ return False -+ -+ - def create_sos_container(self): - '''If the host is containerized, create the container we'll be using - ''' --- -2.17.2 - diff --git a/SOURCES/sos-collector-none-cluster-fix.patch b/SOURCES/sos-collector-none-cluster-fix.patch deleted file mode 100644 index 8b7725e..0000000 --- a/SOURCES/sos-collector-none-cluster-fix.patch +++ /dev/null @@ -1,30 +0,0 @@ -From a614ed8e5621f931d8ee76f1f59747a46144cb2d Mon Sep 17 00:00:00 2001 -From: Jake Hunsaker -Date: Thu, 4 Apr 2019 14:19:13 -0400 -Subject: [PATCH] [jbon] Fix typo in check_enabled() - -Fixes a typo in the check_enabled() method that could potentially -prevent sos-collector from correctly determining the cluster type on -python3 under certain circumstances. - -Signed-off-by: Jake Hunsaker ---- - soscollector/clusters/jbon.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/soscollector/clusters/jbon.py b/soscollector/clusters/jbon.py -index 28552ff..ea85ddf 100644 ---- a/soscollector/clusters/jbon.py -+++ b/soscollector/clusters/jbon.py -@@ -28,7 +28,7 @@ class jbon(Cluster): - def get_nodes(self): - return [] - -- def checK_enabled(self): -+ def check_enabled(self): - # This should never be called, but as insurance explicitly never - # allow this to be enabled via the determine_cluster() path - return False --- -2.17.2 - diff --git a/SOURCES/sos-collector-pexpect.patch b/SOURCES/sos-collector-pexpect.patch deleted file mode 100644 index ca55865..0000000 --- a/SOURCES/sos-collector-pexpect.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 76ca28dc5ce222d24086b387a448ceeb53055e4b Mon Sep 17 00:00:00 2001 -From: Jake Hunsaker -Date: Wed, 15 May 2019 16:21:01 -0400 -Subject: [PATCH] [sosnode] Properly quote commands that need a pty - -When we run locally and need a pty, we need to quote the command and -launch it in a bash shell to function correctly with pexpect.spawn(). - -Signed-off-by: Jake Hunsaker ---- - soscollector/sosnode.py | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/soscollector/sosnode.py b/soscollector/sosnode.py -index 6c01471..fc42b94 100644 ---- a/soscollector/sosnode.py -+++ b/soscollector/sosnode.py -@@ -366,6 +366,9 @@ class SosNode(): - get_pty = True - if not self.local and not force_local: - cmd = "%s %s" % (self.ssh_cmd, quote(cmd)) -+ else: -+ if get_pty: -+ cmd = "/bin/bash -c %s" % quote(cmd) - res = pexpect.spawn(cmd, encoding='utf-8') - if need_root: - if self.config['need_sudo']: --- -2.17.2 - diff --git a/SOURCES/sos-collector-rhcos-image.patch b/SOURCES/sos-collector-rhcos-image.patch deleted file mode 100644 index 2640115..0000000 --- a/SOURCES/sos-collector-rhcos-image.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 6dafb42064b06a80720c6017e2576aea9a7211de Mon Sep 17 00:00:00 2001 -From: Jake Hunsaker -Date: Tue, 9 Apr 2019 13:00:44 -0400 -Subject: [PATCH] [redhat] Update RHCOS image - -Updates the image used by RHCOS nodes to be the rhel8 image instead -of rhel7. - -Signed-off-by: Jake Hunsaker ---- - soscollector/hosts/redhat.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/soscollector/hosts/redhat.py b/soscollector/hosts/redhat.py -index 33cec1f..774ecec 100644 ---- a/soscollector/hosts/redhat.py -+++ b/soscollector/hosts/redhat.py -@@ -66,7 +66,7 @@ class RedHatCoreOSHost(RedHatHost): - - containerized = True - container_runtime = 'podman' -- container_image = 'registry.redhat.io/rhel7/support-tools' -+ container_image = 'registry.redhat.io/rhel8/support-tools' - sos_path_strip = '/host' - - def check_enabled(self, rel_string): --- -2.17.2 - diff --git a/SOURCES/sos-collector-temp-location.patch b/SOURCES/sos-collector-temp-location.patch new file mode 100644 index 0000000..01b7a5c --- /dev/null +++ b/SOURCES/sos-collector-temp-location.patch @@ -0,0 +1,76 @@ +From ac9a24c90cdbaca79951854da1f37d8a10ac8cb9 Mon Sep 17 00:00:00 2001 +From: Jake Hunsaker +Date: Thu, 3 Oct 2019 11:58:04 -0400 +Subject: [PATCH 1/2] [soscollector] Enable --all-logs option + +The --all-logs option, while exposed via sos-collector, was not actually +being passed to sosreport on the remote nodes. + +Now --all-logs is properly passed to sosreport as intended. + +Signed-off-by: Jake Hunsaker +--- + soscollector/sos_collector.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/soscollector/sos_collector.py b/soscollector/sos_collector.py +index 19dc368..55cd0ae 100644 +--- a/soscollector/sos_collector.py ++++ b/soscollector/sos_collector.py +@@ -502,6 +502,8 @@ this utility or remote systems that it connects to. + quote(self.config['case_id'])) + if self.config['alloptions']: + self.config['sos_cmd'] += ' --alloptions' ++ if self.config['all_logs']: ++ self.config['sos_cmd'] += ' --all-logs' + if self.config['verify']: + self.config['sos_cmd'] += ' --verify' + if self.config['log_size']: +-- +2.21.0 + + +From 0f599189909a6f07e148e68aeee7048c12808e37 Mon Sep 17 00:00:00 2001 +From: Jake Hunsaker +Date: Thu, 3 Oct 2019 11:54:18 -0400 +Subject: [PATCH 2/2] [soscollector] Revert temp directory to /var/tmp + +A previous commit inadvertantly changed the default temp directory to be +created under /tmp instead of /var/tmp. This commit fixes that and +returns the default location to /var/tmp. + +Signed-off-by: Jake Hunsaker +--- + soscollector/configuration.py | 2 +- + soscollector/sos_collector.py | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/soscollector/configuration.py b/soscollector/configuration.py +index 1c8baa1..c6f1ce3 100644 +--- a/soscollector/configuration.py ++++ b/soscollector/configuration.py +@@ -45,7 +45,7 @@ class Configuration(dict): + self['ssh_key'] = None + self['sos_cmd'] = 'sosreport --batch' + self['no_local'] = False +- self['tmp_dir'] = None ++ self['tmp_dir'] = '/var/tmp' + self['out_dir'] = '/var/tmp/' + self['nodes'] = [] + self['debug'] = False +diff --git a/soscollector/sos_collector.py b/soscollector/sos_collector.py +index 55cd0ae..93048d9 100644 +--- a/soscollector/sos_collector.py ++++ b/soscollector/sos_collector.py +@@ -209,7 +209,7 @@ class SosCollector(): + if self.config['verbose']: + self.console.debug(msg) + +- def create_tmp_dir(self, location='/tmp'): ++ def create_tmp_dir(self, location='/var/tmp'): + '''Creates a temp directory to transfer sosreports to''' + tmpdir = tempfile.mkdtemp(prefix='sos-collector-', dir=location) + self.config['tmp_dir'] = tmpdir +-- +2.21.0 + diff --git a/SPECS/sos-collector.spec b/SPECS/sos-collector.spec index 551a2fd..7ec09a1 100644 --- a/SPECS/sos-collector.spec +++ b/SPECS/sos-collector.spec @@ -1,7 +1,7 @@ Summary: Capture sosreports from multiple nodes simultaneously Name: sos-collector -Version: 1.7 -Release: 4%{?dist} +Version: 1.8 +Release: 1%{?dist} Source0: http://people.redhat.com/jhunsake/sos-collector/%{name}-%{version}.tar.gz License: GPLv2 BuildArch: noarch @@ -10,10 +10,7 @@ Requires: sos >= 3.0 Obsoletes: clustersos < 1.2.2-2 Provides: clustersos = %{version}-%{release} -Patch0: sos-collector-none-cluster-fix.patch -Patch1: sos-collector-nested-container-fix.patch -Patch2: sos-collector-rhcos-image.patch -Patch3: sos-collector-pexpect.patch +Patch0: sos-collector-temp-location.patch %if 0%{?rhel} == 7 BuildRequires: python-devel @@ -38,9 +35,6 @@ is run on the nodes. %prep %setup -q %patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 %build %if 0%{?rhel} == 7 @@ -79,8 +73,13 @@ install -p -m644 man/en/sos-collector.1 ${RPM_BUILD_ROOT}%{_mandir}/man1/ %license LICENSE %changelog -* Fri May 24 2019 Jake Hunsaker - 1.7-4 +* Mon Oct 14 2019 Jake Hunsaker - 1.8-1 +- Rebase to upstream 1.8 +- Resolves: RHBZ#1751633 + +* Fri May 24 2019 Jake Hunsaker - 1.7-5 - Fix local execution with pexpect +- Fix list output exception * Thu May 02 2019 Jake Hunsaker - 1.7-3 - Backport RHHI-V cluster profile