summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Reboot.hs
diff options
context:
space:
mode:
authorJoey Hess2016-06-13 18:12:29 -0400
committerJoey Hess2016-06-13 18:12:29 -0400
commit5c55d3d4153e571876383e53dc43e38ce767e34d (patch)
tree6eee74e460899d3d0314d721395ffc36933c24f9 /src/Propellor/Property/Reboot.hs
parentd3ced2a6246dbfd736aec59d24b78cecd1d96144 (diff)
improve some comments
Diffstat (limited to 'src/Propellor/Property/Reboot.hs')
-rw-r--r--src/Propellor/Property/Reboot.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/Propellor/Property/Reboot.hs b/src/Propellor/Property/Reboot.hs
index 7733c0d2..5bb426d5 100644
--- a/src/Propellor/Property/Reboot.hs
+++ b/src/Propellor/Property/Reboot.hs
@@ -13,11 +13,20 @@ import Text.ParserCombinators.ReadP
type KernelVersion = String
+-- | Using this property causes an immediate reboot.
+--
+-- So, this is not a useful property on its own, but it can be useful to
+-- compose with other properties. For example:
+--
+-- > Apt.installed ["new-kernel"]
+-- > `onChange` Reboot.now
now :: Property Linux
now = tightenTargets $ cmdProperty "reboot" []
`assume` MadeChange
`describe` "reboot now"
+type Force = Bool
+
-- | Schedules a reboot at the end of the current propellor run.
--
-- The `Result` code of the entire propellor run can be checked;
@@ -25,7 +34,7 @@ now = tightenTargets $ cmdProperty "reboot" []
--
-- The reboot can be forced to run, which bypasses the init system. Useful
-- if the init system might not be running for some reason.
-atEnd :: Bool -> (Result -> Bool) -> Property Linux
+atEnd :: Force -> (Result -> Bool) -> Property Linux
atEnd force resultok = property "scheduled reboot at end of propellor run" $ do
endAction "rebooting" atend
return NoChange
@@ -44,7 +53,8 @@ atEnd force resultok = property "scheduled reboot at end of propellor run" $ do
-- running.
--
-- This will only work if you have taken measures to ensure that the other
--- kernel won't just get booted again. See 'Propellor.Property.DigitalOcean'
+-- kernel won't just get booted again.
+-- See 'Propellor.Property.HostingProvider.DigitalOcean'
-- for an example of how to do this.
toDistroKernel :: Property DebianLike
toDistroKernel = check (not <$> runningInstalledKernel) now