import Text.Printf
import qualified Ganeti.Constants as C
+import qualified Ganeti.Path as Path
import Ganeti.BasicTypes
data GanetiDaemon = GanetiMasterd
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.