Blob Blame History Raw
From 1368498e8d5c5e2d9cd93c335252efe8e08316a4 Mon Sep 17 00:00:00 2001
From: Jake Hunsaker <jhunsake@redhat.com>
Date: Thu, 30 Apr 2020 14:05:21 -0400
Subject: [PATCH] [Plugin] Fix enablement triggers when only restriction is
 architecture

When a plugin, such as the `powerpc` plugin, only defines an
architecture enablement trigger and no files, commands, packages, etc...
our current enablement checks would return false. When the 'normal'
trigger restrictions are all empty, but there is an architecture
trigger, now properly enable based solely on that architecture.

Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
---
 sos/plugins/__init__.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 011113b0..c632d5e4 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -1775,6 +1775,11 @@ class Plugin(object):
         return True
 
     def _check_plugin_triggers(self, files, packages, commands, services):
+
+        if not any([files, packages, commands, services]):
+            # no checks beyond architecture restrictions
+            return self.check_is_architecture()
+
         return ((any(os.path.exists(fname) for fname in files) or
                 any(self.is_installed(pkg) for pkg in packages) or
                 any(is_executable(cmd) for cmd in commands) or
-- 
2.26.2