better container reversion
This commit is contained in:
parent
6456ce3cc0
commit
9cde582c35
|
@ -55,7 +55,7 @@ docked findc hn cn = findContainer findc hn cn $
|
||||||
teardown =
|
teardown =
|
||||||
Property ("undocked " ++ fromContainerId cid) $
|
Property ("undocked " ++ fromContainerId cid) $
|
||||||
report <$> mapM id
|
report <$> mapM id
|
||||||
[ stopContainer cid
|
[ stopContainerIfRunning cid
|
||||||
, removeContainer cid
|
, removeContainer cid
|
||||||
, removeImage image
|
, removeImage image
|
||||||
]
|
]
|
||||||
|
@ -337,6 +337,12 @@ provisionContainer cid = containerDesc cid $ Property "provision" $ do
|
||||||
stopContainer :: ContainerId -> IO Bool
|
stopContainer :: ContainerId -> IO Bool
|
||||||
stopContainer cid = boolSystem dockercmd [Param "stop", Param $ fromContainerId cid ]
|
stopContainer cid = boolSystem dockercmd [Param "stop", Param $ fromContainerId cid ]
|
||||||
|
|
||||||
|
stopContainerIfRunning :: ContainerId -> IO Bool
|
||||||
|
stopContainerIfRunning cid = ifM (elem cid <$> listContainers RunningContainers)
|
||||||
|
( stopContainer cid
|
||||||
|
, return True
|
||||||
|
)
|
||||||
|
|
||||||
removeContainer :: ContainerId -> IO Bool
|
removeContainer :: ContainerId -> IO Bool
|
||||||
removeContainer cid = catchBoolIO $
|
removeContainer cid = catchBoolIO $
|
||||||
snd <$> processTranscript dockercmd ["rm", fromContainerId cid ] Nothing
|
snd <$> processTranscript dockercmd ["rm", fromContainerId cid ] Nothing
|
||||||
|
|
Loading…
Reference in New Issue