Blame SOURCES/sos-bz2079491-plugopts-valtype-str.patch

4b82b4
From 9b10abcdd4aaa41e2549438d5bc52ece86dcb21f Mon Sep 17 00:00:00 2001
4b82b4
From: Pavel Moravec <pmoravec@redhat.com>
4b82b4
Date: Sat, 7 May 2022 14:23:04 +0200
4b82b4
Subject: [PATCH] [plugins] Allow 'str' PlugOpt type to accept any value
4b82b4
4b82b4
For PlugOpt type 'str', we should allow any content including e.g.
4b82b4
numbers, and interpret it as a string.
4b82b4
4b82b4
Resolves: #2922
4b82b4
Closes: #2935
4b82b4
4b82b4
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
4b82b4
---
4b82b4
 sos/report/plugins/__init__.py | 4 ++++
4b82b4
 1 file changed, 4 insertions(+)
4b82b4
4b82b4
diff --git a/sos/report/plugins/__init__.py b/sos/report/plugins/__init__.py
4b82b4
index d6be42b9..2a42e6b0 100644
4b82b4
--- a/sos/report/plugins/__init__.py
4b82b4
+++ b/sos/report/plugins/__init__.py
4b82b4
@@ -452,6 +452,10 @@ class PluginOpt():
4b82b4
         return self.__str__()
4b82b4
 
4b82b4
     def set_value(self, val):
4b82b4
+        # 'str' type accepts any value, incl. numbers
4b82b4
+        if type('') in self.val_type:
4b82b4
+            self.value = str(val)
4b82b4
+            return
4b82b4
         if not any([type(val) == _t for _t in self.val_type]):
4b82b4
             valid = []
4b82b4
             for t in self.val_type:
4b82b4
-- 
4b82b4
2.34.3
4b82b4