From fa06bc09c95c52565e29173535c7422608e9a29b Mon Sep 17 00:00:00 2001
From: Jake Hunsaker <jhunsake@redhat.com>
Date: Fri, 4 Jan 2019 13:35:34 -0500
Subject: [PATCH 1/4] [redhat] Add RHCOS policy
Adds a policy for Red Hat CoreOS.
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
---
sos/policies/redhat.py | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py
index e1e417f3..ea80704f 100644
--- a/sos/policies/redhat.py
+++ b/sos/policies/redhat.py
@@ -379,6 +379,48 @@ organization before being passed to any third party.
return self.find_preset(ATOMIC)
+class RedHatCoreOSPolicy(RHELPolicy):
+ distro = "Red Hat CoreOS"
+ msg = _("""\
+This command will collect diagnostic and configuration \
+information from this %(distro)s system.
+
+An archive containing the collected information will be \
+generated in %(tmpdir)s and may be provided to a %(vendor)s \
+support representative.
+
+Any information provided to %(vendor)s will be treated in \
+accordance with the published support policies at:\n
+ %(vendor_url)s
+
+The generated archive may contain data considered sensitive \
+and its content should be reviewed by the originating \
+organization before being passed to any third party.
+%(vendor_text)s
+""")
+
+ def __init__(self, sysroot=None):
+ super(RedHatCoreOSPolicy, self).__init__(sysroot=sysroot)
+
+ @classmethod
+ def check(cls):
+ coreos = False
+ if ENV_HOST_SYSROOT not in os.environ:
+ return coreos
+ 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
+ except IOError:
+ pass
+ return coreos
+
+ def probe_preset(self):
+ # As of the creation of this policy, RHCOS is only available for
+ # RH OCP environments.
+ return self.find_preset(RHOCP)
+
+
class FedoraPolicy(RedHatPolicy):
distro = "Fedora"
--
2.17.2
From 3335f265213d7457d17139ee172bf21f1a66c229 Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Fri, 18 Jan 2019 18:03:21 +0000
Subject: [PATCH 2/4] [policies] factor out Red Hat disclaimer text
Rather than repeating the same boilerplate disclaimer text in each
Red Hat policy class, define it once as a string, and then cat it
into each policy that requires a distinct preamble.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
---
sos/policies/redhat.py | 48 ++++++++++++++----------------------------
1 file changed, 16 insertions(+), 32 deletions(-)
diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py
index ea80704f..1d1606b6 100644
--- a/sos/policies/redhat.py
+++ b/sos/policies/redhat.py
@@ -229,6 +229,19 @@ rhel_presets = {
note=NOTE_TIME, opts=_opts_verify),
}
+# Legal disclaimer text for Red Hat products
+disclaimer_text = """
+Any information provided to %(vendor)s will be treated in \
+accordance with the published support policies at:\n
+ %(vendor_url)s
+
+The generated archive may contain data considered sensitive \
+and its content should be reviewed by the originating \
+organization before being passed to any third party.
+
+No changes will be made to system configuration.
+"""
+
class RHELPolicy(RedHatPolicy):
distro = RHEL_RELEASE_STR
@@ -242,18 +255,7 @@ applications.
An archive containing the collected information will be \
generated in %(tmpdir)s and may be provided to a %(vendor)s \
support representative.
-
-Any information provided to %(vendor)s will be treated in \
-accordance with the published support policies at:\n
- %(vendor_url)s
-
-The generated archive may contain data considered sensitive \
-and its content should be reviewed by the originating \
-organization before being passed to any third party.
-
-No changes will be made to system configuration.
-%(vendor_text)s
-""")
+""" + disclaimer_text + "%(vendor_text)s\n")
def __init__(self, sysroot=None):
super(RHELPolicy, self).__init__(sysroot=sysroot)
@@ -342,16 +344,7 @@ information from this %(distro)s system.
An archive containing the collected information will be \
generated in %(tmpdir)s and may be provided to a %(vendor)s \
support representative.
-
-Any information provided to %(vendor)s will be treated in \
-accordance with the published support policies at:\n
- %(vendor_url)s
-
-The generated archive may contain data considered sensitive \
-and its content should be reviewed by the originating \
-organization before being passed to any third party.
-%(vendor_text)s
-""")
+""" + disclaimer_text + "%(vendor_text)s\n")
def __init__(self, sysroot=None):
super(RedHatAtomicPolicy, self).__init__(sysroot=sysroot)
@@ -388,16 +381,7 @@ information from this %(distro)s system.
An archive containing the collected information will be \
generated in %(tmpdir)s and may be provided to a %(vendor)s \
support representative.
-
-Any information provided to %(vendor)s will be treated in \
-accordance with the published support policies at:\n
- %(vendor_url)s
-
-The generated archive may contain data considered sensitive \
-and its content should be reviewed by the originating \
-organization before being passed to any third party.
-%(vendor_text)s
-""")
+""" + disclaimer_text + "%(vendor_text)s\n")
def __init__(self, sysroot=None):
super(RedHatCoreOSPolicy, self).__init__(sysroot=sysroot)
--
2.17.2
From ff9b64ffb383b5b57cbba6de665d2b7794849be7 Mon Sep 17 00:00:00 2001
From: Jake Hunsaker <jhunsake@redhat.com>
Date: Fri, 4 Jan 2019 14:43:05 -0500
Subject: [PATCH 3/4] [rhcos] Add new plugin
Adds a new plugin for Red Hat CoreOS
Resolves: #1528
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
---
sos/plugins/rhcos.py | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
create mode 100644 sos/plugins/rhcos.py
diff --git a/sos/plugins/rhcos.py b/sos/plugins/rhcos.py
new file mode 100644
index 00000000..de9af9df
--- /dev/null
+++ b/sos/plugins/rhcos.py
@@ -0,0 +1,30 @@
+# Copyright (C) 2019 Red Hat, Inc., Jake Hunsaker <jhunsake@redhat.com>
+
+# This file is part of the sos project: https://github.com/sosreport/sos
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# version 2 of the GNU General Public License.
+#
+# See the LICENSE file in the source distribution for further information.
+
+from sos.plugins import Plugin, RedHatPlugin
+
+
+class RHCoreOS(Plugin, RedHatPlugin):
+ """Red Hat CoreOS"""
+
+ plugin_name = 'rhcos'
+ packages = ('redhat-release-coreos', 'coreos-metadata')
+
+ def setup(self):
+ units = ['coreos-growpart', 'coreos-firstboot-complete']
+ for unit in units:
+ self.add_journal(unit)
+
+ self.add_cmd_output(
+ 'coreos-metadata --cmdline --attributes /dev/stdout',
+ timeout=60
+ )
+
+# vim: set et ts=4 sw=4 :
--
2.17.2
From 12f12d490866587b254cdf182585529714b7e5bc Mon Sep 17 00:00:00 2001
From: Jake Hunsaker <jhunsake@redhat.com>
Date: Fri, 4 Jan 2019 15:02:55 -0500
Subject: [PATCH 4/4] [rpmostree] Add new plugin
Adds a new plugin for rpm-ostree, which is no longer limited to use in
Atomic Host.
Resolves: #1529
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
---
sos/plugins/atomichost.py | 1 -
sos/plugins/rpmostree.py | 40 +++++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 1 deletion(-)
create mode 100644 sos/plugins/rpmostree.py
diff --git a/sos/plugins/atomichost.py b/sos/plugins/atomichost.py
index deecba87..0c1f4026 100644
--- a/sos/plugins/atomichost.py
+++ b/sos/plugins/atomichost.py
@@ -25,7 +25,6 @@ class AtomicHost(Plugin, RedHatPlugin):
return self.policy.in_container()
def setup(self):
- self.add_copy_spec("/etc/ostree/remotes.d")
self.add_cmd_output("atomic host status")
if self.get_option('info'):
diff --git a/sos/plugins/rpmostree.py b/sos/plugins/rpmostree.py
new file mode 100644
index 00000000..3c6872c2
--- /dev/null
+++ b/sos/plugins/rpmostree.py
@@ -0,0 +1,40 @@
+# Copyright (C) 2019 Red Hat, Inc., Jake Hunsaker <jhunsake@redhat.com>
+
+# This file is part of the sos project: https://github.com/sosreport/sos
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# version 2 of the GNU General Public License.
+#
+# See the LICENSE file in the source distribution for further information.
+
+from sos.plugins import Plugin, RedHatPlugin
+
+
+class Rpmostree(Plugin, RedHatPlugin):
+ """rpm-ostree image/package system"""
+
+ plugin_name = 'rpmostree'
+ packages = ('rpm-ostree',)
+
+ def setup(self):
+ self.add_copy_spec('/etc/ostree/remotes.d/')
+
+ subcmds = [
+ 'status',
+ 'db list',
+ 'db diff',
+ '--version'
+ ]
+
+ self.add_cmd_output(["rpm-ostree %s" % subcmd for subcmd in subcmds])
+
+ units = [
+ 'rpm-ostreed',
+ 'rpm-ostreed-automatic',
+ 'rpm-ostree-bootstatus'
+ ]
+ for unit in units:
+ self.add_journal(unit)
+
+# vim: set et ts=4 sw=4 :
--
2.17.2