From d2970809857fb9b2204fd44e17ada88fdc660ff5 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 11 Dec 2012 00:27:21 +0100
Subject: [PATCH] Support 'null' in Luxi QueryJobs names field

Python code sometimes sends this, so let's support it even though it's
non-standard.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
---
 htools/Ganeti/Luxi.hs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/htools/Ganeti/Luxi.hs b/htools/Ganeti/Luxi.hs
index 65132e017..ff3989239 100644
--- a/htools/Ganeti/Luxi.hs
+++ b/htools/Ganeti/Luxi.hs
@@ -324,8 +324,10 @@ decodeCall (LuxiCall call args) =
   case call of
     ReqQueryJobs -> do
               (jids, jargs) <- fromJVal args
-              let rargs = map fromJSString jargs
-              return $ QueryJobs jids rargs
+              jids' <- case jids of
+                         JSNull -> return []
+                         _ -> fromJVal jids
+              return $ QueryJobs jids' jargs
     ReqQueryInstances -> do
               (names, fields, locking) <- fromJVal args
               return $ QueryInstances names fields locking
-- 
GitLab