Log RPC errors from inside executeRpcCall
authorMichele Tartara <mtartara@google.com>
Wed, 10 Jul 2013 14:48:05 +0000 (14:48 +0000)
committerMichele Tartara <mtartara@google.com>
Thu, 11 Jul 2013 11:42:17 +0000 (13:42 +0200)
executeRpcCall is the function to be used for executing RPCs, so it makes sense
to use it as the single point for logging all thte RPC call errors.

Fixes Issue 293.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

src/Ganeti/Query/Node.hs
src/Ganeti/Rpc.hs

index f8a9d90..293ceb7 100644 (file)
@@ -233,7 +233,6 @@ collectLiveData True cfg nodes = do
              Nothing -> (n : bn, gn, em)
       (bnodes, gnodes, emap) = foldr step ([], [], []) nodes
   rpcres <- executeRpcCall gnodes (RpcCallNodeInfo vgs hvs (Map.fromList emap))
-  logRpcErrors rpcres
   -- FIXME: The order of nodes in the result could be different from the input
   return $ zip bnodes (repeat $ Left (RpcResultError "Broken configuration"))
            ++ rpcres
index 5c3c8bb..d3503e8 100644 (file)
@@ -231,7 +231,9 @@ executeRpcCall nodes call = do
                 Ok r -> return r
   -- now parse the replies
   let results'' = map (parseHttpReply call) results'
-  return $ zip nodes results''
+      pairedList = zip nodes results''
+  logRpcErrors pairedList
+  return pairedList
 
 -- | Helper function that is used to read dictionaries of values.
 sanitizeDictResults :: [(String, J.Result a)] -> ERpcError [(String, a)]