Move part of the loader pipeline to ClusterData
[ganeti-local] / Ganeti / HTools / Utils.hs
index 7bc4ead..45b9d5e 100644 (file)
@@ -41,6 +41,7 @@ module Ganeti.HTools.Utils
     , tryRead
     , formatTable
     , annotateResult
+    , defaultGroupID
     ) where
 
 import Control.Monad (liftM)
@@ -72,13 +73,13 @@ debugXy a b = debug a `seq` b
 commaJoin :: [String] -> String
 commaJoin = intercalate ","
 
--- | Split a string on a separator and return an array.
-sepSplit :: Char -> String -> [String]
+-- | Split a list on a separator and return an array.
+sepSplit :: Eq a => a -> [a] -> [[a]]
 sepSplit sep s
-    | x == "" && xs == [] = []
-    | xs == []            = [x]
-    | ys == []            = [x,""]
-    | otherwise           = x:sepSplit sep ys
+    | null s    = []
+    | null xs   = [x]
+    | null ys   = [x,[]]
+    | otherwise = x:sepSplit sep ys
     where (x, xs) = break (== sep) s
           ys = drop 1 xs
 
@@ -207,3 +208,7 @@ formatTable vals numpos =
                              ) flds
                     ) (zip3 vtrans numpos mlens)
    in transpose expnd
+
+-- | Default group UUID (just a string, not a real UUID)
+defaultGroupID :: GroupID
+defaultGroupID = "00000000-0000-0000-0000-000000000000"