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 =
|
||||
Property ("undocked " ++ fromContainerId cid) $
|
||||
report <$> mapM id
|
||||
[ stopContainer cid
|
||||
[ stopContainerIfRunning cid
|
||||
, removeContainer cid
|
||||
, removeImage image
|
||||
]
|
||||
|
@ -337,6 +337,12 @@ provisionContainer cid = containerDesc cid $ Property "provision" $ do
|
|||
stopContainer :: ContainerId -> IO Bool
|
||||
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 cid = catchBoolIO $
|
||||
snd <$> processTranscript dockercmd ["rm", fromContainerId cid ] Nothing
|
||||
|
|
Loading…
Reference in New Issue