summaryrefslogtreecommitdiff
path: root/src/Propellor/Engine.hs
diff options
context:
space:
mode:
authorJoey Hess2015-01-25 15:16:58 -0400
committerJoey Hess2015-01-25 15:16:58 -0400
commit401b857eef13ca7d3f7b8f6b88e9237884fcd906 (patch)
treeeb4b5c189349b5a86b3b39edbe039956d3a1a3b8 /src/Propellor/Engine.hs
parent1df70ba81ddfbd4ceeb5344793f7714a35706c8f (diff)
parentcdd88b080af534231aae8a64ef327f0597a5b5b3 (diff)
Merge branch 'joeyconfig'
Conflicts: doc/todo/info_propigation_out_of_nested_properties.mdwn privdata.joey/privdata.gpg
Diffstat (limited to 'src/Propellor/Engine.hs')
-rw-r--r--src/Propellor/Engine.hs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Propellor/Engine.hs b/src/Propellor/Engine.hs
index 667f6bfb..99f1660d 100644
--- a/src/Propellor/Engine.hs
+++ b/src/Propellor/Engine.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE PackageImports #-}
+{-# LANGUAGE GADTs #-}
module Propellor.Engine (
mainProperties,
@@ -35,7 +36,7 @@ import Utility.Monad
mainProperties :: Host -> IO ()
mainProperties host = do
ret <- runPropellor host $
- ensureProperties [Property "overall" (ensureProperties $ hostProperties host) mempty]
+ ensureProperties [ignoreInfo $ infoProperty "overall" (ensureProperties ps) mempty mempty]
h <- mkMessageHandle
whenConsole h $
setTitle "propellor: done"
@@ -43,6 +44,8 @@ mainProperties host = do
case ret of
FailedChange -> exitWith (ExitFailure 1)
_ -> exitWith ExitSuccess
+ where
+ ps = map ignoreInfo $ hostProperties host
-- | Runs a Propellor action with the specified host.
--
@@ -62,11 +65,13 @@ runEndAction host res (EndAction desc a) = actionMessageOn (hostName host) desc
-- | For when code running in the Propellor monad needs to ensure a
-- Property.
-ensureProperty :: Property -> Propellor Result
+--
+-- This can only be used on a Property that has NoInfo.
+ensureProperty :: Property NoInfo -> Propellor Result
ensureProperty = catchPropellor . propertySatisfy
-- | Ensures a list of Properties, with a display of each as it runs.
-ensureProperties :: [Property] -> Propellor Result
+ensureProperties :: [Property NoInfo] -> Propellor Result
ensureProperties ps = ensure ps NoChange
where
ensure [] rs = return rs
@@ -77,7 +82,7 @@ ensureProperties ps = ensure ps NoChange
-- | Lifts an action into a different host.
--
--- For example, `fromHost hosts "otherhost" getPubKey`
+-- > fromHost hosts "otherhost" getPubKey
fromHost :: [Host] -> HostName -> Propellor a -> Propellor (Maybe a)
fromHost l hn getter = case findHost l hn of
Nothing -> return Nothing