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

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