aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2019-01-04 13:35:34 -0500
committerBryn M. Reeves <bmr@redhat.com>2019-01-18 17:27:48 +0000
commitfa06bc09c95c52565e29173535c7422608e9a29b (patch)
treead8b8acdbfe3175b22a083615f96b48eb5febc00
parent5f40365c453128f2ee7f0a22f11eb3434fedd64a (diff)
downloadsos-fa06bc09c95c52565e29173535c7422608e9a29b.tar.gz
[redhat] Add RHCOS policy
Adds a policy for Red Hat CoreOS. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/policies/redhat.py42
1 files changed, 42 insertions, 0 deletions
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"