summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2015-11-01 12:15:16 -0400
committerJoey Hess2015-11-01 12:15:16 -0400
commitada8035a2a1d4d6cf7463266272a51bc2768fb63 (patch)
tree3c99827495348dc0c50972fed34c4c9dec5fdaed
parent0afa0c0593b655af475ecc9db1e3add7d2c18299 (diff)
a few tweaks for concurrent output
Force console mode when --spin calls SimpleRun
-rw-r--r--src/Propellor/CmdLine.hs5
-rw-r--r--src/Propellor/Spin.hs14
2 files changed, 9 insertions, 10 deletions
diff --git a/src/Propellor/CmdLine.hs b/src/Propellor/CmdLine.hs
index 4bca3986..4a4f71fe 100644
--- a/src/Propellor/CmdLine.hs
+++ b/src/Propellor/CmdLine.hs
@@ -120,8 +120,9 @@ defaultMain hostlist = withConcurrentOutput $ do
go False (Spin hs mrelay) = do
commitSpin
forM_ hs $ \hn -> withhost hn $ spin mrelay hn
- go False cmdline@(SimpleRun hn) = buildFirst cmdline $
- go False (Run hn)
+ go False cmdline@(SimpleRun hn) = do
+ forceConsole
+ buildFirst cmdline $ go False (Run hn)
go False (Run hn) = ifM ((==) 0 <$> getRealUserID)
( onlyprocess $ withhost hn mainProperties
, go True (Spin [hn] Nothing)
diff --git a/src/Propellor/Spin.hs b/src/Propellor/Spin.hs
index 478d1517..6048a1cd 100644
--- a/src/Propellor/Spin.hs
+++ b/src/Propellor/Spin.hs
@@ -29,7 +29,6 @@ import Propellor.Types.Info
import qualified Propellor.Shim as Shim
import Utility.FileMode
import Utility.SafeCommand
-import Utility.ConcurrentOutput
commitSpin :: IO ()
commitSpin = do
@@ -61,10 +60,9 @@ spin' mprivdata relay target hst = do
updateServer target relay hst
(proc "ssh" $ cacheparams ++ [sshtarget, shellWrap probecmd])
(proc "ssh" $ cacheparams ++ [sshtarget, shellWrap updatecmd])
- getprivdata
+ =<< getprivdata
-- And now we can run it.
- flushConcurrentOutput
unlessM (boolSystem "ssh" (map Param $ cacheparams ++ ["-t", sshtarget, shellWrap runcmd])) $
error "remote propellor failed"
where
@@ -191,16 +189,16 @@ updateServer
-> Host
-> CreateProcess
-> CreateProcess
- -> IO PrivMap
+ -> PrivMap
-> IO ()
-updateServer target relay hst connect haveprecompiled getprivdata =
+updateServer target relay hst connect haveprecompiled privdata =
withIOHandles createProcessSuccess connect go
where
hn = fromMaybe target relay
go (toh, fromh) = do
let loop = go (toh, fromh)
- let restart = updateServer hn relay hst connect haveprecompiled getprivdata
+ let restart = updateServer hn relay hst connect haveprecompiled privdata
let done = return ()
v <- maybe Nothing readish <$> getMarked fromh statusMarker
case v of
@@ -208,7 +206,7 @@ updateServer target relay hst connect haveprecompiled getprivdata =
sendRepoUrl toh
loop
(Just NeedPrivData) -> do
- sendPrivData hn toh =<< getprivdata
+ sendPrivData hn toh privdata
loop
(Just NeedGitClone) -> do
hClose toh
@@ -219,7 +217,7 @@ updateServer target relay hst connect haveprecompiled getprivdata =
hClose toh
hClose fromh
sendPrecompiled hn
- updateServer hn relay hst haveprecompiled (error "loop") getprivdata
+ updateServer hn relay hst haveprecompiled (error "loop") privdata
(Just NeedGitPush) -> do
sendGitUpdate hn fromh toh
hClose fromh