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

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