summaryrefslogtreecommitdiff
path: root/src/Propellor/Property
diff options
context:
space:
mode:
Diffstat (limited to 'src/Propellor/Property')
-rw-r--r--src/Propellor/Property/Cmd.hs6
-rw-r--r--src/Propellor/Property/Docker.hs9
-rw-r--r--src/Propellor/Property/Firewall.hs3
3 files changed, 7 insertions, 11 deletions
diff --git a/src/Propellor/Property/Cmd.hs b/src/Propellor/Property/Cmd.hs
index 725f5757..d24b1a8a 100644
--- a/src/Propellor/Property/Cmd.hs
+++ b/src/Propellor/Property/Cmd.hs
@@ -13,7 +13,6 @@ import "mtl" Control.Monad.Reader
import Propellor.Types
import Propellor.Property
-import Utility.Monad
import Utility.SafeCommand
import Utility.Env
@@ -28,10 +27,7 @@ cmdProperty cmd params = cmdProperty' cmd params []
cmdProperty' :: String -> [String] -> [(String, String)] -> Property
cmdProperty' cmd params env = property desc $ liftIO $ do
env' <- addEntries env <$> getEnvironment
- ifM (boolSystemEnv cmd (map Param params) (Just env'))
- ( return MadeChange
- , return FailedChange
- )
+ toResult <$> boolSystemEnv cmd (map Param params) (Just env')
where
desc = unwords $ cmd : params
diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs
index 5fa06517..5006ed9a 100644
--- a/src/Propellor/Property/Docker.hs
+++ b/src/Propellor/Property/Docker.hs
@@ -379,9 +379,10 @@ runningContainer cid@(ContainerId hn cn) image runps = containerDesc cid $ prope
createDirectoryIfMissing True (takeDirectory $ identFile cid)
shim <- liftIO $ Shim.setup (localdir </> "propellor") Nothing (localdir </> shimdir cid)
liftIO $ writeFile (identFile cid) (show ident)
- ensureProperty $ boolProperty "run" $ runContainer img
- (runps ++ ["-i", "-d", "-t"])
- [shim, "--continue", show (DockerInit (fromContainerId cid))]
+ ensureProperty $ property "run" $ liftIO $
+ toResult <$> runContainer img
+ (runps ++ ["-i", "-d", "-t"])
+ [shim, "--continue", show (DockerInit (fromContainerId cid))]
-- | Called when propellor is running inside a docker container.
-- The string should be the container's ContainerId.
@@ -466,7 +467,7 @@ stoppedContainer :: ContainerId -> Property
stoppedContainer cid = containerDesc cid $ property desc $
ifM (liftIO $ elem cid <$> listContainers RunningContainers)
( liftIO cleanup `after` ensureProperty
- (boolProperty desc $ stopContainer cid)
+ (property desc $ liftIO $ toResult <$> stopContainer cid)
, return NoChange
)
where
diff --git a/src/Propellor/Property/Firewall.hs b/src/Propellor/Property/Firewall.hs
index b660207b..3018f989 100644
--- a/src/Propellor/Property/Firewall.hs
+++ b/src/Propellor/Property/Firewall.hs
@@ -33,8 +33,7 @@ rule c t rs = property ("firewall rule: " <> show r) addIpTable
exist <- boolSystem "iptables" (chk args)
if exist
then return NoChange
- else ifM (boolSystem "iptables" (add args))
- ( return MadeChange , return FailedChange)
+ else toResult <$> boolSystem "iptables" (add args)
add params = (Param "-A") : params
chk params = (Param "-C") : params