summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Whitton2019-04-03 13:05:05 -0700
committerJoey Hess2019-04-03 16:55:08 -0400
commit4058420697197eb210e4b2aa0f0ae4732d0dbdaf (patch)
tree0092a42e0c993b51676528ef8851c0147b522fcb /src
parentf5d95a92a209d91b0e574c27d58260c6088ff33d (diff)
make Cron.runPropellor revertable
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/Property/Cron.hs15
1 files changed, 9 insertions, 6 deletions
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