- when (optShowVer opts) $ do
- printf $ CLI.showVersion "hn1"
- exitWith ExitSuccess
-
- (env_node, env_inst) <- CLI.parseEnv ()
- let nodef = if optNodeSet opts then optNodef opts
- else env_node
- instf = if optInstSet opts then optInstf opts
- else env_inst
- min_depth = optMinDepth opts
- (node_data, inst_data) =
- case optMaster opts of
- "" -> (readFile nodef,
- readFile instf)
- host -> (getNodes host >>= readData,
- getInstances host >>= readData)
-
- (loaded_nl, il, csf, ktn, kti) <- liftM2 Cluster.loadData node_data inst_data
-
- let (fix_msgs, nl) = Cluster.checkData loaded_nl il ktn kti
-
- unless (null fix_msgs) $ do
- putStrLn "Warning: cluster has inconsistent data:"
- putStrLn . unlines . map (\s -> printf " - %s" s) $ fix_msgs