From e6d9c792e72848e7977020fa9a3311fefff8e710 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 4 Apr 2014 15:47:06 -0400 Subject: propellor spin --- Propellor/Property/Docker.hs | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'Propellor') diff --git a/Propellor/Property/Docker.hs b/Propellor/Property/Docker.hs index bcd27c59..e96603f5 100644 --- a/Propellor/Property/Docker.hs +++ b/Propellor/Property/Docker.hs @@ -233,23 +233,19 @@ runningContainer cid@(ContainerId hn cn) image containerprops = containerDesc ci else do error "container parameters changed" void $ stopContainer cid - oldimage <- fromMaybe image <$> commitContainer cid - void $ removeContainer cid - go oldimage - else do - ifM (elem cid <$> listContainers AllContainers) - ( do - -- Contaner may be stopped, or - -- may not exist. - void $ stopContainer cid - oldimage <- fromMaybe image <$> commitContainer cid - void $ removeContainer cid - go oldimage - , go image - ) + restartcontainer + else ifM (elem cid <$> listContainers AllContainers) + ( restartcontainer + , go image + ) where ident = ContainerIdent image hn cn runps + restartcontainer = do + oldimage <- fromMaybe image <$> commitContainer cid + void $ removeContainer cid + go oldimage + getrunningident :: IO (Maybe ContainerIdent) getrunningident = simpleShClient (namedPipe cid) "cat" [propellorIdent] $ \rs -> do print (rs, extractident rs) -- cgit v1.3-2-g0d8e