Commit 25fc9f85 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Make ConfigWrite support write with follow-up action



...to allow, e.g., config unlock while the config is still written out.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent edc7340e
......@@ -38,6 +38,7 @@ module Ganeti.WConfd.ConfigWriter
( loadConfigFromFile
, readConfig
, writeConfig
, writeConfigWithImmediate
, saveConfigAsyncTask
, distMCsAsyncTask
, distSSConfAsyncTask
......@@ -100,6 +101,13 @@ readConfig = csConfigData <$> readConfigState
writeConfig :: ConfigData -> WConfdMonad ()
writeConfig cd = modifyConfigState $ const ((), mkConfigState cd)
-- Replaces the current configuration state within the 'WConfdMonad',
-- immediately followed by another action (while config writeout is
-- still happening).
writeConfigWithImmediate :: ConfigData -> WConfdMonad () -> WConfdMonad ()
writeConfigWithImmediate cd act =
flip modifyConfigStateWithImmediate act $ const ((), mkConfigState cd)
-- * Asynchronous tasks
-- | Runs the given action on success, or logs an error on failure.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment