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 ++++++++++-------------- config-joey.hs | 3 +-- 2 files changed, 11 insertions(+), 16 deletions(-) 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) diff --git a/config-joey.hs b/config-joey.hs index cf739d82..975434d3 100644 --- a/config-joey.hs +++ b/config-joey.hs @@ -36,7 +36,6 @@ host hostname@"clam.kitenet.net" = standardSystem Unstable $ props & Tor.isBridge & JoeySites.oldUseNetshellBox & Docker.configured - ! Docker.docked container hostname "amd64-git-annex-builder" & Docker.garbageCollected -- Orca is the main git-annex build box. host hostname@"orca.kitenet.net" = standardSystem Unstable $ props @@ -45,7 +44,7 @@ host hostname@"orca.kitenet.net" = standardSystem Unstable $ props & Docker.configured & Apt.buildDep ["git-annex"] & Docker.docked container hostname "amd64-git-annex-builder" - & Docker.docked container hostname "i386-git-annex-builder" + ! Docker.docked container hostname "i386-git-annex-builder" & Docker.garbageCollected -- My laptop host _hostname@"darkstar.kitenet.net" = Just $ props -- cgit v1.2.3