Monitoring CLI tools might have to load serialized lists of instances
(mainly for testing reasons). This patch adds an option to allow that.

Signed-off-by: Michele Tartara <[email protected]>
---
 src/Ganeti/DataCollectors/CLI.hs | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/Ganeti/DataCollectors/CLI.hs b/src/Ganeti/DataCollectors/CLI.hs
index db30441..d807d07 100644
--- a/src/Ganeti/DataCollectors/CLI.hs
+++ b/src/Ganeti/DataCollectors/CLI.hs
@@ -40,6 +40,7 @@ module Ganeti.DataCollectors.CLI
   , oConfdAddr
   , oConfdPort
   , oInputFile
+  , oInstances
   , genericOptions
   ) where
 
@@ -67,6 +68,9 @@ data Options = Options
                                      -- connect to
   , optInputFile   :: Maybe FilePath -- ^ Path to the file containing the
                                      -- information to be parsed
+  , optInstances   :: Maybe FilePath -- ^ Path to the file contained a
+                                     -- serialized list of instances as in:
+                                     -- ([Primary], [Secondary])
   } deriving Show
 
 -- | Default values for the command line options.
@@ -81,6 +85,7 @@ defaultOptions  = Options
   , optConfdAddr   = Nothing
   , optConfdPort   = Nothing
   , optInputFile   = Nothing
+  , optInstances   = Nothing
   }
 
 -- | Abbreviation for the option type.
@@ -138,6 +143,13 @@ oInputFile =
       "the input FILE",
     OptComplFile)
 
+oInstances :: OptType
+oInstances =
+  ( Option "i" ["instances"]
+      (ReqArg (\ f o -> Ok o { optInstances = Just f}) "FILE")
+      "the FILE containing serialized instances",
+    OptComplFile)
+
 -- | Generic options.
 genericOptions :: [GenericOptType Options]
 genericOptions =  [ oShowVer
-- 
1.8.3

Reply via email to