From 26d47cf503be8b681f3654fdb8131429af3ad558 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Tue, 14 Jul 2009 16:00:48 +0200 Subject: [PATCH] CLI: Prevent incompatible options to be selected This patch makes CLI abort if more than one backend is selected. --- Ganeti/HTools/CLI.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Ganeti/HTools/CLI.hs b/Ganeti/HTools/CLI.hs index a3bdafa09..61edc35b4 100644 --- a/Ganeti/HTools/CLI.hs +++ b/Ganeti/HTools/CLI.hs @@ -152,6 +152,16 @@ loadExternalData opts = do else env_inst mhost = masterName opts lsock = luxiSocket opts + setRapi = mhost /= "" + setLuxi = isJust lsock + setFiles = nodeSet opts || instSet opts + allSet = filter id [setRapi, setLuxi, setFiles] + when (length allSet > 1) $ + do + hPutStrLn stderr "Error: Only one of the rapi, luxi, and data\ + \ files options should be given." + exitWith $ ExitFailure 1 + input_data <- case () of _ | mhost /= "" -> Rapi.loadData mhost -- GitLab