From 4058420697197eb210e4b2aa0f0ae4732d0dbdaf Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 3 Apr 2019 13:05:05 -0700 Subject: make Cron.runPropellor revertable Signed-off-by: Sean Whitton --- src/Propellor/Property/Cron.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/Propellor/Property') diff --git a/src/Propellor/Property/Cron.hs b/src/Propellor/Property/Cron.hs index 737c144f..25540fae 100644 --- a/src/Propellor/Property/Cron.hs +++ b/src/Propellor/Property/Cron.hs @@ -87,12 +87,15 @@ niceJob desc times user cddir command = job desc times user cddir ("nice ionice -c 3 sh -c " ++ shellEscape command) -- | Installs a cron job to run propellor. -runPropellor :: Times -> Property DebianLike -runPropellor times = withOS "propellor cron job" $ \w o -> do - bootstrapper <- getBootstrapper - ensureProperty w $ - niceJob "propellor" times (User "root") localdir - (bootstrapPropellorCommand bootstrapper o ++ "; ./propellor") +runPropellor :: Times -> RevertableProperty DebianLike UnixLike +runPropellor times = cronned uncronned + where + cronned = withOS "propellor cron job" $ \w o -> do + bootstrapper <- getBootstrapper + ensureProperty w $ + niceJob "propellor" times (User "root") localdir + (bootstrapPropellorCommand bootstrapper o ++ "; ./propellor") + uncronned = jobDropped "propellor" times -- Utility functions -- cgit v1.2.3