summaryrefslogtreecommitdiff
path: root/Propellor/Property
diff options
context:
space:
mode:
authorJoey Hess2014-04-04 15:47:06 -0400
committerJoey Hess2014-04-04 15:47:06 -0400
commite6d9c792e72848e7977020fa9a3311fefff8e710 (patch)
tree628669b514c03da6cf6870a0c9b498feb78a9032 /Propellor/Property
parentb9e7721db0fedbbc6d1d32f54fbf011e0514e9df (diff)
propellor spin
Diffstat (limited to 'Propellor/Property')
-rw-r--r--Propellor/Property/Docker.hs24
1 files changed, 10 insertions, 14 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)