Revision 41238d27 src/Ganeti/HTools/Program/Harep.hs

b/src/Ganeti/HTools/Program/Harep.hs
1
{-# LANGUAGE TupleSections #-}
2

  
1 3
{-| Auto-repair tool for Ganeti.
2 4

  
3 5
-}
......
35 37
import Data.Maybe
36 38
import Data.Ord
37 39
import System.Time
40
import qualified Data.Map as Map
38 41

  
39 42
import Ganeti.BasicTypes
40 43
import Ganeti.Common
......
461 464
                            ArHealthy _ -> doRepair c jobDelay i
462 465
                            _           -> const (return i)
463 466

  
464
  _unused_repairDone <- bracket (L.getClient master) L.closeClient $
465
                        forM (zip iniData' repairs) . maybeRepair
467
  repairDone <- bracket (L.getClient master) L.closeClient $
468
                forM (zip iniData' repairs) . maybeRepair
469

  
470
  -- Print some stats and exit.
471
  let states = map ((, 1 :: Int) . arStateName . arState) repairDone
472
      counts = Map.fromListWith (+) states
466 473

  
467
  return ()
474
  putStrLn "---------------------"
475
  putStrLn "Instance status count"
476
  putStrLn "---------------------"
477
  putStr . unlines . Map.elems $
478
    Map.mapWithKey (\k v -> k ++ ": " ++ show v) counts

Also available in: Unified diff