Merge branch 'devel-2.6' into submit
[ganeti-local] / htools / Ganeti / Ssconf.hs
index e0020cc..192e925 100644 (file)
@@ -45,8 +45,9 @@ import System.FilePath ((</>))
 import System.IO.Error (isDoesNotExistError)
 
 import qualified Ganeti.Constants as C
+import qualified Ganeti.Path as Path
 import Ganeti.BasicTypes
-import Ganeti.HTools.Utils
+import Ganeti.Utils
 
 -- | Maximum ssconf file size we support.
 maxFileSize :: Int
@@ -85,7 +86,7 @@ $(declareSADT "SSKey"
 keyToFilename :: Maybe FilePath     -- ^ Optional config path override
               -> SSKey              -- ^ ssconf key
               -> FilePath
-keyToFilename optpath key = fromMaybe C.dataDir optpath </>
+keyToFilename optpath key = fromMaybe Path.dataDir optpath </>
                             sSFilePrefix ++ sSKeyToRaw key
 
 -- | Runs an IO action while transforming any error into 'Bad'
@@ -128,5 +129,5 @@ parseIPFamily fam | fam == C.ip4Family = Ok Socket.AF_INET
 getPrimaryIPFamily :: Maybe FilePath -> IO (Result Socket.Family)
 getPrimaryIPFamily optpath = do
   result <- readSSConfFile optpath (Just (show C.ip4Family)) SSPrimaryIpFamily
-  return (result >>= return . rstripSpace >>=
+  return (liftM rstripSpace result >>=
           tryRead "Parsing af_family" >>= parseIPFamily)