import sos-collector-1.8-1.el8

This commit is contained in:
CentOS Sources 2020-01-21 17:49:34 -05:00 committed by Stepan Oksanichenko
parent 992cea58ee
commit a02fb7f9a8
8 changed files with 87 additions and 160 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/sos-collector-1.7.tar.gz
SOURCES/sos-collector-1.8.tar.gz

View File

@ -1 +1 @@
5a4f3d843e90ac35af70c2da2e1b18a62df036c3 SOURCES/sos-collector-1.7.tar.gz
32b09cbab87d66d8b19f95db977c29f0fb828202 SOURCES/sos-collector-1.8.tar.gz

View File

@ -1,59 +0,0 @@
From 0bc831a07be6ae837cb9029943c57255c47b647f Mon Sep 17 00:00:00 2001
From: Jake Hunsaker <jhunsake@redhat.com>
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 <jhunsake@redhat.com>
---
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

View File

@ -1,30 +0,0 @@
From a614ed8e5621f931d8ee76f1f59747a46144cb2d Mon Sep 17 00:00:00 2001
From: Jake Hunsaker <jhunsake@redhat.com>
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 <jhunsake@redhat.com>
---
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

View File

@ -1,30 +0,0 @@
From 76ca28dc5ce222d24086b387a448ceeb53055e4b Mon Sep 17 00:00:00 2001
From: Jake Hunsaker <jhunsake@redhat.com>
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 <jhunsake@redhat.com>
---
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

View File

@ -1,29 +0,0 @@
From 6dafb42064b06a80720c6017e2576aea9a7211de Mon Sep 17 00:00:00 2001
From: Jake Hunsaker <jhunsake@redhat.com>
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 <jhunsake@redhat.com>
---
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

View File

@ -0,0 +1,76 @@
From ac9a24c90cdbaca79951854da1f37d8a10ac8cb9 Mon Sep 17 00:00:00 2001
From: Jake Hunsaker <jhunsake@redhat.com>
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 <jhunsake@redhat.com>
---
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 <jhunsake@redhat.com>
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 <jhunsake@redhat.com>
---
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

View File

@ -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 <jhunsake@redhat.com> - 1.7-4
* Mon Oct 14 2019 Jake Hunsaker <jhunsake@redhat.com> - 1.8-1
- Rebase to upstream 1.8
- Resolves: RHBZ#1751633
* Fri May 24 2019 Jake Hunsaker <jhunsake@redhat.com> - 1.7-5
- Fix local execution with pexpect
- Fix list output exception
* Thu May 02 2019 Jake Hunsaker <jhunsake@redhat.com> - 1.7-3
- Backport RHHI-V cluster profile