summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/Engine.hs6
-rw-r--r--src/Propellor/Property/Apt.hs6
-rw-r--r--src/Propellor/Property/Docker.hs2
3 files changed, 10 insertions, 4 deletions
diff --git a/src/Propellor/Engine.hs b/src/Propellor/Engine.hs
index 0b65fb7e..81cc2397 100644
--- a/src/Propellor/Engine.hs
+++ b/src/Propellor/Engine.hs
@@ -77,12 +77,16 @@ processChainOutput h = go Nothing
where
go lastline = do
v <- catchMaybeIO (hGetLine h)
+ debug ["read from chained propellor: ", show v]
case v of
Nothing -> case lastline of
- Nothing -> pure FailedChange
+ Nothing -> do
+ debug ["chained propellor output nothing; assuming it failed"]
+ return FailedChange
Just l -> case readish l of
Just r -> pure r
Nothing -> do
+ debug ["chained propellor output did not end with a Result; assuming it failed"]
putStrLn l
hFlush stdout
return FailedChange
diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs
index 471d6195..68e877ed 100644
--- a/src/Propellor/Property/Apt.hs
+++ b/src/Propellor/Property/Apt.hs
@@ -193,13 +193,15 @@ isInstalled p = (== [True]) <$> isInstalled' [p]
-- even vary. If apt does not know about a package at all, it will not
-- be included in the result list.
isInstalled' :: [Package] -> IO [Bool]
-isInstalled' ps = catMaybes . map parse . lines
- <$> readProcess "apt-cache" ("policy":ps)
+isInstalled' ps = catMaybes . map parse . lines <$> policy
where
parse l
| "Installed: (none)" `isInfixOf` l = Just False
| "Installed: " `isInfixOf` l = Just True
| otherwise = Nothing
+ policy = do
+ environ <- addEntry "LANG" "C" <$> getEnvironment
+ readProcessEnv "apt-cache" ("policy":ps) (Just environ)
autoRemove :: Property
autoRemove = runApt ["-y", "autoremove"]
diff --git a/src/Propellor/Property/Docker.hs b/src/Propellor/Property/Docker.hs
index 586ebc2e..5fa06517 100644
--- a/src/Propellor/Property/Docker.hs
+++ b/src/Propellor/Property/Docker.hs
@@ -430,7 +430,7 @@ provisionContainer cid = containerDesc cid $ property "provisioned" $ liftIO $ d
let params = ["--continue", show $ toChain cid]
msgh <- mkMessageHandle
let p = inContainerProcess cid
- [ if isConsole msgh then "-it" else "-i" ]
+ (if isConsole msgh then ["-it"] else [])
(shim : params)
r <- withHandle StdoutHandle createProcessSuccess p $
processChainOutput