summaryrefslogtreecommitdiff
path: root/src/Propellor/Engine.hs
diff options
context:
space:
mode:
authorJoey Hess2016-03-25 14:04:40 -0400
committerJoey Hess2016-03-25 14:04:40 -0400
commit91d1833155a2e8be2c435d0a92a750cc9d2f30b5 (patch)
treebd9662a258b4b0544e19295a319b61086a201d6f /src/Propellor/Engine.hs
parent48a05503493caeb80794a872b0e3b4482d5859ce (diff)
ported Property.List
I wanted to keep propertyList [foo, bar] working, but had some difficulty making the type class approach work. Anyway, that's unlikely to be useful, since foo and bar probably have different types, or could easiy have their types updated breaking it.
Diffstat (limited to 'src/Propellor/Engine.hs')
-rw-r--r--src/Propellor/Engine.hs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Propellor/Engine.hs b/src/Propellor/Engine.hs
index 2e914d67..62fad5af 100644
--- a/src/Propellor/Engine.hs
+++ b/src/Propellor/Engine.hs
@@ -2,10 +2,10 @@
{-# LANGUAGE GADTs #-}
module Propellor.Engine (
- mainProperties,
+ -- mainProperties,
runPropellor,
ensureProperty,
- ensureProperties,
+ ensureChildProperties,
fromHost,
fromHost',
onlyProcess,
@@ -29,6 +29,8 @@ import Propellor.Info
import Propellor.Property
import Utility.Exception
+{-
+
-- | Gets the Properties of a Host, and ensures them all,
-- with nice display of what's being done.
mainProperties :: Host -> IO ()
@@ -42,6 +44,8 @@ mainProperties host = do
where
ps = map ignoreInfo $ hostProperties host
+-}
+
-- | Runs a Propellor action with the specified host.
--
-- If the Result is not FailedChange, any EndActions
@@ -58,14 +62,14 @@ runEndAction host res (EndAction desc a) = actionMessageOn (hostName host) desc
(ret, _s, _) <- runRWST (runWithHost (catchPropellor (a res))) host ()
return ret
--- | Ensures a list of Properties, with a display of each as it runs.
-ensureProperties :: [Property NoInfo] -> Propellor Result
-ensureProperties ps = ensure ps NoChange
+-- | Ensures the child properties, with a display of each as it runs.
+ensureChildProperties :: [ChildProperty] -> Propellor Result
+ensureChildProperties ps = ensure ps NoChange
where
ensure [] rs = return rs
ensure (p:ls) rs = do
hn <- asks hostName
- r <- actionMessageOn hn (propertyDesc p) (ensureProperty p)
+ r <- actionMessageOn hn (getDesc p) (catchPropellor $ getSatisfy p)
ensure ls (r <> rs)
-- | Lifts an action into the context of a different host.