X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/e0eb63f07dca0dcfb323fca28085cf2774fcc707..585d442011204bb0b5b57dc30e4d17adc6bf1e8f:/Ganeti/HTools/CLI.hs diff --git a/Ganeti/HTools/CLI.hs b/Ganeti/HTools/CLI.hs index 1a30f58..3d14b4d 100644 --- a/Ganeti/HTools/CLI.hs +++ b/Ganeti/HTools/CLI.hs @@ -9,11 +9,13 @@ and this is more IO oriented. module Ganeti.HTools.CLI ( parseOpts + , parseEnv , showVersion , shTemplate ) where import System.Console.GetOpt +import System.Posix.Env import System.IO import System.Info import System @@ -46,6 +48,13 @@ parseOpts argv progname options defaultOptions fn = where header = printf "%s %s\nUsage: %s [OPTION...]" progname Version.version progname +-- | Parse the environment and return the node/instance names. +-- This also hardcodes here the default node/instance file names. +parseEnv :: () -> IO (String, String) +parseEnv () = do + a <- getEnvDefault "HTOOLS_NODES" "nodes" + b <- getEnvDefault "HTOOLS_INSTANCES" "instances" + return (a, b) -- | Return a version string for the program showVersion :: String -- ^ The program name