From 0adb72a5972d39a1797630cb262a8494b9ba863b Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sun, 10 Mar 2024 00:41:49 +0300 Subject: [PATCH] Fix the fresh set_state() bug found by unittest This function should write 'self.state' anyway. Refers to #88, #89, #97 --- kernel_hardening_checker/engine.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel_hardening_checker/engine.py b/kernel_hardening_checker/engine.py index 8ba34ef..960f4f4 100644 --- a/kernel_hardening_checker/engine.py +++ b/kernel_hardening_checker/engine.py @@ -62,10 +62,9 @@ class OptCheck: return None def set_state(self, data): - if data: - assert(isinstance(data, str)), \ + assert(data is None or isinstance(data, str)), \ f'invalid state "{data}" for "{self.name}" check' - self.state = data + self.state = data def check(self): # handle the 'is present' check -- 2.31.1