diff options
| author | Joey Hess <id@joeyh.name> | 2014-12-06 06:34:32 -0400 |
|---|---|---|
| committer | Joey Hess <id@joeyh.name> | 2014-12-06 06:34:32 -0400 |
| commit | fcff7762e395378791f01c9ea8507b41a4d7d501 (patch) | |
| tree | c5f3c910e93a7741c3326e729140dbd8b210e36b /src/Propellor/Property.hs | |
| parent | c97dd0d7088fa981f762070e06fc8058ab04cdbd (diff) | |
endAction can be used to register an action to run once propellor has successfully run on a host.
Diffstat (limited to 'src/Propellor/Property.hs')
| -rw-r--r-- | src/Propellor/Property.hs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Propellor/Property.hs b/src/Propellor/Property.hs index 6ace5e4e..1533471e 100644 --- a/src/Propellor/Property.hs +++ b/src/Propellor/Property.hs @@ -7,7 +7,7 @@ import System.FilePath import Control.Monad import Data.Monoid import Control.Monad.IfElse -import "mtl" Control.Monad.Reader +import "mtl" Control.Monad.RWS.Strict import Propellor.Types import Propellor.Info @@ -131,11 +131,11 @@ boolProperty desc a = property desc $ ifM (liftIO a) revert :: RevertableProperty -> RevertableProperty revert (RevertableProperty p1 p2) = RevertableProperty p2 p1 --- Changes the action that is performed to satisfy a property. +-- | Changes the action that is performed to satisfy a property. adjustProperty :: Property -> (Propellor Result -> Propellor Result) -> Property adjustProperty p f = p { propertySatisfy = f (propertySatisfy p) } --- Combines the Info of two properties. +-- | Combines the Info of two properties. combineInfo :: (IsProp p, IsProp q) => p -> q -> Info combineInfo p q = getInfo p <> getInfo q @@ -147,3 +147,8 @@ makeChange a = liftIO a >> return MadeChange noChange :: Propellor Result noChange = return NoChange + +-- | Registers an action that should be run at the very end, +-- and only when all configured Properties of the host succeed. +endAction :: Desc -> Propellor Result -> Propellor () +endAction desc a = tell [EndAction desc a] |
