Improve mon-collector drbd CLI handling
[ganeti-local] / htools / Ganeti / Runtime.hs
index b6371d3..2ebef2e 100644 (file)
@@ -49,6 +49,7 @@ import System.Posix.User
 import Text.Printf
 
 import qualified Ganeti.Constants as C
+import qualified Ganeti.Path as Path
 import Ganeti.BasicTypes
 
 data GanetiDaemon = GanetiMasterd
@@ -91,13 +92,16 @@ daemonGroup (ExtraGroup  DaemonsGroup)  = C.daemonsGroup
 daemonGroup (ExtraGroup  AdminGroup)    = C.adminGroup
 
 -- | Returns the log file for a daemon.
-daemonLogFile :: GanetiDaemon -> FilePath
-daemonLogFile GanetiConfd = C.daemonsLogfilesGanetiConfd
-daemonLogFile _           = error "Unimplemented"
+daemonLogFile :: GanetiDaemon -> IO FilePath
+daemonLogFile daemon = do
+  logDir <- Path.logDir
+  return $ logDir </> daemonName daemon <.> "log"
 
 -- | Returns the pid file name for a daemon.
-daemonPidFile :: GanetiDaemon -> FilePath
-daemonPidFile daemon = C.runGanetiDir </> daemonName daemon <.> "pid"
+daemonPidFile :: GanetiDaemon -> IO FilePath
+daemonPidFile daemon = do
+  runDir <- Path.runDir
+  return $ runDir </> daemonName daemon <.> "pid"
 
 -- | All groups list. A bit hacking, as we can't enforce it's complete
 -- at compile time.