From e88fc57d1e266364db8ac4b14c976a6949b276bd Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 14 Jun 2010 22:09:23 +0200 Subject: [PATCH] Fix the type of 'valid' attribute in LUDiagnoseOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The update of the valid status in LUDiagnoseOS says: valid = valid and osl and osl[0][1] However, in Python, βTrue and []β (which '[]' we get for an invalid OS) will result in β[]β, and thus the valid field for an OS will be either True or an empty list. Which is not what we wantβ¦ Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- lib/cmdlib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 880c5a0b7..1f890a5df 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -2780,7 +2780,7 @@ class LUDiagnoseOS(NoHooksLU): valid = True variants = None for osl in os_data.values(): - valid = valid and osl and osl[0][1] + valid = bool(valid and osl and osl[0][1]) if not valid: variants = set() break -- GitLab