tuned/bugfix-check_positive-has-some-contradictions.patch
dufuhang 3abad467c4 check_positive has some contradictions
1. 在`check_positive()`函数的raise语句中,错误信息与if条件冲突。
2. 如果`val`的值为 0,它会通过if条件,但会抛出错误信息,提示`[0 has to be >= 0]`。
3. 该PR移除了raise语句中的`=`,因此当`val`为0时,会正确提示`val`的值`[has to be > 0]`。

(cherry picked from commit 66dea7cbb83f724a40d5995a0e5de4ea6566d235)
2024-09-19 15:45:48 +08:00

26 lines
663 B
Diff

From d55d5c280758b6fed2c8c598a380c3c6cdc11b18 Mon Sep 17 00:00:00 2001
From: dufuhang <dufuhang@kylinos.cn>
Date: Thu, 19 Sep 2024 14:15:53 +0800
Subject: [PATCH] check_positive has some contradictions
---
tuned-adm.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tuned-adm.py b/tuned-adm.py
index fcf19e2..6e5ac85 100755
--- a/tuned-adm.py
+++ b/tuned-adm.py
@@ -34,7 +34,7 @@ def check_positive(value):
except ValueError:
val = -1
if val <= 0:
- raise argparse.ArgumentTypeError("%s has to be >= 0" % value)
+ raise argparse.ArgumentTypeError("%s has to be > 0" % value)
return val
def check_log_level(value):
--
2.43.0