Commit 142538ff authored by Iustin Pop's avatar Iustin Pop
Browse files

Enhance the command list for the solution

This patch moves the formatting of the command list to Cluster.hs and
enhances it with separator messages between the steps.
parent 79ac6b6f
......@@ -23,6 +23,7 @@ module Cluster
, applySolution
, printSolution
, printSolutionLine
, formatCmds
, printNodes
-- * Balacing functions
, checkMove
......@@ -569,6 +570,13 @@ printSolutionLine il ktn kti nmlen imlen plc =
pmlen nstr c moves,
cmds)
formatCmds :: [[String]] -> String
formatCmds cmd_strs =
unlines $ map (" echo " ++) $
concat $ map (\(a, b) ->
(printf "step %d" (a::Int)):(map ("gnt-instance" ++) b)) $
zip [1..] cmd_strs
{-| Converts a solution to string format -}
printSolution :: InstanceList
-> [(Int, String)]
......
......@@ -185,8 +185,7 @@ main = do
do
putStrLn ""
putStrLn "Commands to run to reach the above solution:"
putStr $ unlines $ map (" echo gnt-instance " ++)
$ concat $ reverse cmd_strs
putStr . Cluster.formatCmds . reverse $ cmd_strs
when (optShowNodes opts) $
do
let (orig_mem, orig_disk) = Cluster.totalResources nl
......
......@@ -187,7 +187,8 @@ main = do
do
putStrLn ""
putStrLn "Commands to run to reach the above solution:"
putStr $ unlines $ map (" echo gnt-instance " ++) $ concat cmd_strs
putStr . Cluster.formatCmds . reverse $ cmd_strs
when (optShowNodes opts) $
do
let (orig_mem, orig_disk) = Cluster.totalResources nl
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment