From 69b0d82a11569658810171588ca661a1d0d513a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Nussbaumer?= <rn@google.com>
Date: Tue, 18 Sep 2012 16:11:28 +0200
Subject: [PATCH] Fix a validation issue
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

We want to validate the result only if the iallocation run was a
success.

Signed-off-by: RenΓ© Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
---
 lib/masterd/iallocator.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/masterd/iallocator.py b/lib/masterd/iallocator.py
index 8a04b26f5..566276342 100644
--- a/lib/masterd/iallocator.py
+++ b/lib/masterd/iallocator.py
@@ -130,7 +130,7 @@ class IARequestBase(objectutils.ValidatedSlots):
     @raises ResultValidationError: If validation fails
 
     """
-    if not (ia.success and self.REQ_RESULT(result)):
+    if ia.success and not self.REQ_RESULT(result):
       raise errors.ResultValidationError("iallocator returned invalid result,"
                                          " expected %s, got %s" %
                                          (self.REQ_RESULT, result))
-- 
GitLab