From 4440c9094d853a452cbff6f9801fc7d47352e9b4 Mon Sep 17 00:00:00 2001
From: Jake Hunsaker <jhunsake@redhat.com>
Date: Thu, 6 Sep 2018 13:56:20 -0400
Subject: [PATCH] [atomic] Define valid preset for RHEL Atomic
Defines an 'atomic' preset for use with the RedHatAtomic policy for RHEL
Atomic Host. Fixes sos being unable to run due to the preset probe
returning a string rather than a preset.
Resolves: #1418
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
---
sos/policies/redhat.py | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py
index b494de3c..e1e417f3 100644
--- a/sos/policies/redhat.py
+++ b/sos/policies/redhat.py
@@ -325,6 +325,12 @@ No changes will be made to system configuration.
ATOMIC = "atomic"
ATOMIC_RELEASE_STR = "Atomic"
+ATOMIC_DESC = "Red Hat Enterprise Linux Atomic Host"
+
+atomic_presets = {
+ ATOMIC: PresetDefaults(name=ATOMIC, desc=ATOMIC_DESC, note=NOTE_TIME,
+ opts=_opts_verify)
+}
class RedHatAtomicPolicy(RHELPolicy):
@@ -347,6 +353,10 @@ organization before being passed to any third party.
%(vendor_text)s
""")
+ def __init__(self, sysroot=None):
+ super(RedHatAtomicPolicy, self).__init__(sysroot=sysroot)
+ self.register_presets(atomic_presets)
+
@classmethod
def check(cls):
atomic = False
@@ -363,7 +373,10 @@ organization before being passed to any third party.
return atomic
def probe_preset(self):
- return ATOMIC
+ if self.pkg_by_name('atomic-openshift'):
+ return self.find_preset(RHOCP)
+
+ return self.find_preset(ATOMIC)
class FedoraPolicy(RedHatPolicy):
--
2.17.1