avoid console output when chaining into chroot and not at console
This commit is contained in:
parent
9f9a4c653f
commit
a904476333
|
@ -85,8 +85,8 @@ defaultMain hostlist = do
|
||||||
go _ (Edit field context) = editPrivData field context
|
go _ (Edit field context) = editPrivData field context
|
||||||
go _ ListFields = listPrivDataFields hostlist
|
go _ ListFields = listPrivDataFields hostlist
|
||||||
go _ (AddKey keyid) = addKey keyid
|
go _ (AddKey keyid) = addKey keyid
|
||||||
|
go _ (ChrootChain hn loc onconsole) = Chroot.chain hostlist hn loc onconsole
|
||||||
go _ (DockerChain hn cid) = Docker.chain hostlist hn cid
|
go _ (DockerChain hn cid) = Docker.chain hostlist hn cid
|
||||||
go _ (ChrootChain hn loc) = Chroot.chain hostlist hn loc
|
|
||||||
go _ (DockerInit hn) = Docker.init hn
|
go _ (DockerInit hn) = Docker.init hn
|
||||||
go _ (GitPush fin fout) = gitPushHelper fin fout
|
go _ (GitPush fin fout) = gitPushHelper fin fout
|
||||||
go _ (Update _) = forceConsole >> fetchFirst (onlyprocess update)
|
go _ (Update _) = forceConsole >> fetchFirst (onlyprocess update)
|
||||||
|
|
|
@ -89,19 +89,22 @@ provisionChroot c@(Chroot loc _ _) = property (chrootDesc c "provisioned") $ do
|
||||||
|
|
||||||
chainprovision shim = do
|
chainprovision shim = do
|
||||||
parenthost <- asks hostName
|
parenthost <- asks hostName
|
||||||
|
cmd <- liftIO $ toChain parenthost c
|
||||||
let p = inChrootProcess c
|
let p = inChrootProcess c
|
||||||
[ shim
|
[ shim
|
||||||
, "--continue"
|
, "--continue"
|
||||||
, show $ toChain parenthost c
|
, show cmd
|
||||||
]
|
]
|
||||||
liftIO $ withHandle StdoutHandle createProcessSuccess p
|
liftIO $ withHandle StdoutHandle createProcessSuccess p
|
||||||
processChainOutput
|
processChainOutput
|
||||||
|
|
||||||
toChain :: HostName -> Chroot -> CmdLine
|
toChain :: HostName -> Chroot -> IO CmdLine
|
||||||
toChain parenthost (Chroot loc _ _) = ChrootChain parenthost loc
|
toChain parenthost (Chroot loc _ _) = do
|
||||||
|
onconsole <- isConsole <$> mkMessageHandle
|
||||||
|
return $ ChrootChain parenthost loc onconsole
|
||||||
|
|
||||||
chain :: [Host] -> HostName -> FilePath -> IO ()
|
chain :: [Host] -> HostName -> FilePath -> Bool -> IO ()
|
||||||
chain hostlist hn loc = case findHostNoAlias hostlist hn of
|
chain hostlist hn loc onconsole = case findHostNoAlias hostlist hn of
|
||||||
Nothing -> errorMessage ("cannot find host " ++ hn)
|
Nothing -> errorMessage ("cannot find host " ++ hn)
|
||||||
Just parenthost -> case M.lookup loc (_chroots $ _chrootinfo $ hostInfo parenthost) of
|
Just parenthost -> case M.lookup loc (_chroots $ _chrootinfo $ hostInfo parenthost) of
|
||||||
Nothing -> errorMessage ("cannot find chroot " ++ loc ++ " on host " ++ hn)
|
Nothing -> errorMessage ("cannot find chroot " ++ loc ++ " on host " ++ hn)
|
||||||
|
@ -109,7 +112,7 @@ chain hostlist hn loc = case findHostNoAlias hostlist hn of
|
||||||
where
|
where
|
||||||
go h = do
|
go h = do
|
||||||
changeWorkingDirectory localdir
|
changeWorkingDirectory localdir
|
||||||
forceConsole
|
when onconsole forceConsole
|
||||||
onlyProcess (provisioningLock loc) $ do
|
onlyProcess (provisioningLock loc) $ do
|
||||||
r <- runPropellor h $ ensureProperties $ hostProperties h
|
r <- runPropellor h $ ensureProperties $ hostProperties h
|
||||||
putStrLn $ "\n" ++ show r
|
putStrLn $ "\n" ++ show r
|
||||||
|
|
|
@ -155,7 +155,7 @@ data CmdLine
|
||||||
| Update HostName
|
| Update HostName
|
||||||
| DockerInit HostName
|
| DockerInit HostName
|
||||||
| DockerChain HostName String
|
| DockerChain HostName String
|
||||||
| ChrootChain HostName FilePath
|
| ChrootChain HostName FilePath Bool
|
||||||
| GitPush Fd Fd
|
| GitPush Fd Fd
|
||||||
deriving (Read, Show, Eq)
|
deriving (Read, Show, Eq)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue