From d8e9131b47da88f2d5c7611263b3d4cd58c1ace7 Mon Sep 17 00:00:00 2001
From: Michele Tartara <mtartara@google.com>
Date: Tue, 18 Dec 2012 14:51:09 +0000
Subject: [PATCH] Add function to fetch the list of master candidates

This commits adds to the Haskell codebase a function to fetch the list of
IPs of the master candidates from the SSConf database.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 htools/Ganeti/Ssconf.hs | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/htools/Ganeti/Ssconf.hs b/htools/Ganeti/Ssconf.hs
index 20cfeb396..ed0dbbdad 100644
--- a/htools/Ganeti/Ssconf.hs
+++ b/htools/Ganeti/Ssconf.hs
@@ -30,6 +30,7 @@ module Ganeti.Ssconf
   , sSKeyToRaw
   , sSKeyFromRaw
   , getPrimaryIPFamily
+  , getMasterCandidatesIps
   , keyToFilename
   , sSFilePrefix
   ) where
@@ -127,3 +128,9 @@ getPrimaryIPFamily optpath = do
   result <- readSSConfFile optpath (Just (show C.ip4Family)) SSPrimaryIpFamily
   return (liftM rStripSpace result >>=
           tryRead "Parsing af_family" >>= parseIPFamily)
+
+-- | Read the list of IP addresses of the master candidates of the cluster.
+getMasterCandidatesIps :: Maybe FilePath -> IO (Result [String])
+getMasterCandidatesIps optPath = do
+  result <- readSSConfFile optPath Nothing SSMasterCandidatesIps
+  return $ liftM lines result
-- 
GitLab