From 9e406feb0d3ff8b41b616da7d6a8e464fed3cb2a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Nov 2015 11:53:02 -0400 Subject: propellor spin --- src/Propellor/Spin.hs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Propellor/Spin.hs b/src/Propellor/Spin.hs index 478d1517..9cb86f5b 100644 --- a/src/Propellor/Spin.hs +++ b/src/Propellor/Spin.hs @@ -61,10 +61,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 +190,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 +207,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 +218,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 -- cgit v1.3-2-g0d8e From 278ec56483e62803e60c643189080ae9df14c753 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Nov 2015 11:54:16 -0400 Subject: propellor spin --- src/Propellor/Spin.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Propellor/Spin.hs b/src/Propellor/Spin.hs index 9cb86f5b..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 -- cgit v1.3-2-g0d8e -- cgit v1.3-2-g0d8e From 4b4dd3122516559a95dac4f17fc011f607f4ff76 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Nov 2015 12:00:10 -0400 Subject: propellor spin --- src/Utility/ConcurrentOutput.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Utility/ConcurrentOutput.hs b/src/Utility/ConcurrentOutput.hs index 4676c2fa..3494aa63 100644 --- a/src/Utility/ConcurrentOutput.hs +++ b/src/Utility/ConcurrentOutput.hs @@ -228,6 +228,8 @@ createProcessConcurrent p | otherwise = ss firstprocess = do + hPutStrLn stderr "RUNNING FG" + hFlush stderr r@(_, _, _, h) <- P.createProcess p `onException` dropOutputLock -- Wait for the process to exit and drop the lock. @@ -237,6 +239,8 @@ createProcessConcurrent p return r concurrentprocess = do + hPutStrLn stderr "RUNNING BG" + hFlush stderr (toouth, fromouth) <- pipe (toerrh, fromerrh) <- pipe let p' = p -- cgit v1.3-2-g0d8e -- cgit v1.3-2-g0d8e -- cgit v1.3-2-g0d8e -- cgit v1.3-2-g0d8e From fdaedbd4a1afeef5b46c16978b7e5fd681110275 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 1 Nov 2015 12:12:05 -0400 Subject: propellor spin --- src/Propellor/CmdLine.hs | 5 +++-- src/Utility/ConcurrentOutput.hs | 4 ---- 2 files changed, 3 insertions(+), 6 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/Utility/ConcurrentOutput.hs b/src/Utility/ConcurrentOutput.hs index 3494aa63..4676c2fa 100644 --- a/src/Utility/ConcurrentOutput.hs +++ b/src/Utility/ConcurrentOutput.hs @@ -228,8 +228,6 @@ createProcessConcurrent p | otherwise = ss firstprocess = do - hPutStrLn stderr "RUNNING FG" - hFlush stderr r@(_, _, _, h) <- P.createProcess p `onException` dropOutputLock -- Wait for the process to exit and drop the lock. @@ -239,8 +237,6 @@ createProcessConcurrent p return r concurrentprocess = do - hPutStrLn stderr "RUNNING BG" - hFlush stderr (toouth, fromouth) <- pipe (toerrh, fromerrh) <- pipe let p' = p -- cgit v1.3-2-g0d8e -- cgit v1.3-2-g0d8e