Fix htools/rpc-test after recent changes
authorIustin Pop <iustin@google.com>
Thu, 29 Nov 2012 19:23:58 +0000 (20:23 +0100)
committerIustin Pop <iustin@google.com>
Fri, 30 Nov 2012 13:57:56 +0000 (14:57 +0100)
Since this program is not built normally, a few recent commits broke
it:

- 707cd3d (“Use exitErr instead of explicit error message and
  exitWith”) introduced wrong syntax (missing '$')
- 29a3053 (“Remove unsafePerformIO usage”) changed the signature of
  G.Path.clusterConfFile
- 5183e8b (“Convert query path from string errors to GanetiException”)
  changed the signature of 'getNode'

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

htools/rpc-test.hs

index 394ab9d..6102258 100644 (file)
@@ -24,9 +24,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 -}
 
 import System.Environment
-import System.Exit
-import System.IO
 
+import Ganeti.Errors
 import Ganeti.Config
 import Ganeti.Objects
 import qualified Ganeti.Path as P
@@ -37,7 +36,7 @@ import Ganeti.Utils
 usage :: IO ()
 usage = do
   prog <- getProgName
-  exitErr "Usage: " ++ prog ++ " delay node..."
+  exitErr $ "Usage: " ++ prog ++ " delay node..."
 
 main :: IO ()
 main = do
@@ -46,10 +45,11 @@ main = do
                       [] -> usage >> return ("", []) -- workaround types...
                       _:[] -> usage >> return ("", [])
                       x:xs -> return (x, xs)
-  cfg <- loadConfig P.clusterConfFile >>=
-         exitIfBad "Can't load configuration"
+  cfg_file <- P.clusterConfFile
+  cfg <- loadConfig  cfg_file>>= exitIfBad "Can't load configuration"
   let call = RpcCallTestDelay (read delay)
-  nodes' <- exitIfBad "Can't find node" $ mapM (getNode cfg) nodes
+  nodes' <- exitIfBad "Can't find node" . errToResult $
+            mapM (getNode cfg) nodes
   results <- executeRpcCall nodes' call
   putStr $ printTable "" ["Node", "Result"]
            (map (\(n, r) -> [nodeName n, show r]) results) [False, False]