From 0b7fb010321ecde043fa1293ef793a3f36cf2ff0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 4 Apr 2014 14:55:34 -0400 Subject: propellor spin --- Propellor/Property/Docker.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Propellor') diff --git a/Propellor/Property/Docker.hs b/Propellor/Property/Docker.hs index 7a605b02..e625a129 100644 --- a/Propellor/Property/Docker.hs +++ b/Propellor/Property/Docker.hs @@ -223,8 +223,12 @@ runningContainer cid@(ContainerId hn cn) image containerprops = containerDesc ci l <- listContainers RunningContainers if cid `elem` l then do + -- Check if the ident has changed; if so the + -- parameters of the container differ and it must + -- be restarted. runningident <- getrunningident - if (ident2id <$> runningident) == Just (ident2id ident) + print runningident + if runningident == Just ident then return NoChange else do void $ stopContainer cid @@ -238,11 +242,10 @@ runningContainer cid@(ContainerId hn cn) image containerprops = containerDesc ci where ident = ContainerIdent image hn cn runps + getrunningident :: IO (Maybe ContainerIdent) getrunningident = catchDefaultIO Nothing $ - simpleShClient (namedPipe cid) "cat" [propellorIdent] $ \vs -> do - print vs - -- pure . headMaybe . catMaybes . map readish . catMaybes . map getStdout - return Nothing + simpleShClient (namedPipe cid) "cat" [propellorIdent] $ + pure . headMaybe . catMaybes . map readish . catMaybes . map getStdout runps = getRunParams $ containerprops ++ -- expose propellor directory inside the container -- cgit v1.2.3