Blame SOURCES/sos-bz1627546-atomic-attribute-error.patch

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