summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoey Hess2014-12-21 21:40:26 -0400
committerJoey Hess2014-12-21 21:40:26 -0400
commit6d56dbd35ae10c3c51f14e441fd9f90a0c53c92f (patch)
tree7cd7ed5ac175282183e6466d354904420af18e16 /src
parenta68bd830acfa90949462189e47783a4d257739bc (diff)
parentdc36a98fc159794395512ff2ae78eb8e0acb0ea5 (diff)
Merge branch 'joeyconfig'
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/Engine.hs22
-rw-r--r--src/Propellor/Property/Docker.hs3
2 files changed, 6 insertions, 19 deletions
diff --git a/src/Propellor/Engine.hs b/src/Propellor/Engine.hs
index dc8b2bc5..f29ce1a9 100644
--- a/src/Propellor/Engine.hs
+++ b/src/Propellor/Engine.hs
@@ -23,7 +23,6 @@ import System.FilePath
import System.Directory
import Propellor.Types
-import Propellor.Types.Empty
import Propellor.Message
import Propellor.Exception
import Propellor.Info
@@ -36,7 +35,7 @@ import Utility.Monad
mainProperties :: Host -> IO ()
mainProperties host = do
ret <- runPropellor host $
- ensureProperties [Property "overall" (ensurePropertiesWith ensureProperty' $ hostProperties host) mempty]
+ ensureProperties [Property "overall" (ensureProperties $ hostProperties host) mempty]
h <- mkMessageHandle
whenConsole h $
setTitle "propellor: done"
@@ -63,30 +62,17 @@ runEndAction host res (EndAction desc a) = actionMessageOn (hostName host) desc
-- | For when code running in the Propellor monad needs to ensure a
-- Property.
---
--- Note that any info of the Property is not propigated out to
--- the enclosing Property, and so will not be available for propellor to
--- use. A warning message will be printed if this is detected.
ensureProperty :: Property -> Propellor Result
-ensureProperty p = do
- unless (isEmpty (getInfo p)) $
- warningMessage $ "ensureProperty called on " ++ show p ++ "; will not propigate its info: " ++ show (getInfo p)
- ensureProperty' p
-
-ensureProperty' :: Property -> Propellor Result
-ensureProperty' = catchPropellor . propertySatisfy
+ensureProperty = catchPropellor . propertySatisfy
-- | Ensures a list of Properties, with a display of each as it runs.
ensureProperties :: [Property] -> Propellor Result
-ensureProperties = ensurePropertiesWith ensureProperty
-
-ensurePropertiesWith :: (Property -> Propellor Result) -> [Property] -> Propellor Result
-ensurePropertiesWith a ps = ensure ps NoChange
+ensureProperties ps = ensure ps NoChange
where
ensure [] rs = return rs
ensure (p:ls) rs = do
hn <- asks hostName
- r <- actionMessageOn hn (propertyDesc p) (a p)
+ r <- actionMessageOn hn (propertyDesc p) (ensureProperty p)
ensure ls (r <> rs)
-- | Lifts an action into a different host.
diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs
index b48afbbb..02bda2e9 100644
--- a/src/Propellor/Property/Docker.hs
+++ b/src/Propellor/Property/Docker.hs
@@ -456,7 +456,8 @@ chain hostlist hn s = case toContainerId s of
go cid h = do
changeWorkingDirectory localdir
onlyProcess (provisioningLock cid) $ do
- r <- runPropellor h $ ensureProperties $ hostProperties h
+ r <- runPropellor h $ ensureProperties $
+ hostProperties h
putStrLn $ "\n" ++ show r
stopContainer :: ContainerId -> IO Bool