Fallback to a rm -f action for podman
There is a podman specific behavior that cannot be reproduced with
docker:
$ docker run -itd --privileged --name=foo busybox sleep 1000
$ docker exec -it foo sh -c "sleep 180"
$ kill -STOP <that process>
$ docker stop foo
$ docker rm foo
works w/o errors, while podman fails the latter step:
Error: cannot remove container <id> has active exec sessions: container
state improper
To make it consistent, add a fallback to re-try it with rm -f.
Related-bug: #1860004
Change-Id: Id387f624078ef874aa902656952582c9c54f3f2e
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
(cherry picked from commit 3006b547cb
)
This commit is contained in:
parent
0207aeac42
commit
6dfd2d07d3
|
@ -287,8 +287,14 @@ class BaseRunner(object):
|
|||
cmd = [self.cont_cmd, 'rm', container]
|
||||
cmd_stdout, cmd_stderr, returncode = self.execute(cmd, self.log)
|
||||
if returncode != 0:
|
||||
self.log.error('Error removing container: %s' % container)
|
||||
self.log.error('Error removing container '
|
||||
'gracefully: %s' % container)
|
||||
self.log.error(cmd_stderr)
|
||||
cmd = [self.cont_cmd, 'rm', '-f', container]
|
||||
cmd_stdout, cmd_stderr, returncode = self.execute(cmd, self.log)
|
||||
if returncode != 0:
|
||||
self.log.error('Error removing container: %s' % container)
|
||||
self.log.error(cmd_stderr)
|
||||
|
||||
def stop_container(self, container, cont_cmd=None, quiet=False):
|
||||
cont_cmd = cont_cmd or self.cont_cmd
|
||||
|
|
Loading…
Reference in New Issue