summaryrefslogtreecommitdiff
path: root/Propellor/Property
diff options
context:
space:
mode:
authorJoey Hess2014-04-04 14:55:34 -0400
committerJoey Hess2014-04-04 14:55:34 -0400
commit0b7fb010321ecde043fa1293ef793a3f36cf2ff0 (patch)
treed0a46647fe37990db83074cb69105db01c580fe7 /Propellor/Property
parentd96bc41d068b9f47273fdc9ca2f127d9ebc9d1f9 (diff)
propellor spin
Diffstat (limited to 'Propellor/Property')
-rw-r--r--Propellor/Property/Docker.hs13
1 files changed, 8 insertions, 5 deletions
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