Revision a246ce76 src/Ganeti/Rpc.hs

b/src/Ganeti/Rpc.hs
33 33
  , ERpcError
34 34
  , explainRpcError
35 35
  , executeRpcCall
36
  , logRpcErrors
36 37

  
37 38
  , rpcCallName
38 39
  , rpcCallTimeout
......
83 84

  
84 85
import Ganeti.BasicTypes
85 86
import qualified Ganeti.Constants as C
87
import Ganeti.Logging
86 88
import Ganeti.Objects
87 89
import Ganeti.THH
88 90
import Ganeti.Types
......
194 196
       J.JSString msg -> Left $ RpcResultError (J.fromJSString msg)
195 197
       _ -> Left . JsonDecodeError $ show (pp_value jerr)
196 198

  
199
-- | Scan the list of results produced by executeRpcCall and log all the RPC
200
-- errors.
201
logRpcErrors :: [(a, ERpcError b)] -> IO ()
202
logRpcErrors allElems =
203
  let logOneRpcErr (_, Right _) = return ()
204
      logOneRpcErr (_, Left err) =
205
        logError $ "Error in the RPC HTTP reply: " ++ show err
206
  in mapM_ logOneRpcErr allElems
207

  
197 208
-- | Execute RPC call for many nodes in parallel.
198 209
executeRpcCall :: (Rpc a b) => [Node] -> a -> IO [(Node, ERpcError b)]
199 210
executeRpcCall nodes call = do

Also available in: Unified diff