Fix payload check for out-of-band health
authorRené Nussbaumer <rn@google.com>
Tue, 25 Jan 2011 12:53:37 +0000 (13:53 +0100)
committerRené Nussbaumer <rn@google.com>
Wed, 26 Jan 2011 09:17:57 +0000 (10:17 +0100)
This logic error was not detected before as health has not been
implemented on the cli and therefore no QA code existed for that.

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

lib/cmdlib.py

index 032a0db..a39c8f8 100644 (file)
@@ -3296,10 +3296,11 @@ class LUOobCommand(NoHooksLU):
       if not isinstance(result.payload, list):
         errs.append("command 'health' is expected to return a list but got %s" %
                     type(result.payload))
-      for item, status in result.payload:
-        if status not in constants.OOB_STATUSES:
-          errs.append("health item '%s' has invalid status '%s'" %
-                      (item, status))
+      else:
+        for item, status in result.payload:
+          if status not in constants.OOB_STATUSES:
+            errs.append("health item '%s' has invalid status '%s'" %
+                        (item, status))
 
     if self.op.command == constants.OOB_POWER_STATUS:
       if not isinstance(result.payload, dict):