From 03f26d045ef3b36e13a260382acd16871441ab3d Mon Sep 17 00:00:00 2001 From: Rabi Mishra Date: Tue, 19 Nov 2019 21:27:18 +0530 Subject: [PATCH] Fix regression in removing containers in container-puppet.py Commit 7282c11285b457980f79a7c372e4b3e874e66288 removed changes in commit 529ad2d7772ced181d9273d4615d90c86ef3ba41 to call 'rm' twice, i.e once without '--storage' and once with. Change-Id: I2f6dac3e1c9842ccc1dc922d2be16a11a4927a11 Related-Bug: #1840691 --- common/container-puppet.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/common/container-puppet.py b/common/container-puppet.py index 3b66542ed2..e05d1a58a4 100755 --- a/common/container-puppet.py +++ b/common/container-puppet.py @@ -142,21 +142,25 @@ def rm_container(name): if stderr: LOG.debug(stderr) + def rm_process_call(rm_cli_cmd): + stdout, stderr, retval = local_subprocess_call( + cmd=rm_cli_cmd) + if stdout: + LOG.debug(stdout) + if stderr and 'Error response from daemon' in stderr: + LOG.debug(stderr) + LOG.info('Removing container: %s' % name) rm_cli_cmd = [CLI_CMD, 'rm'] + rm_cli_cmd.append(name) + rm_process_call(rm_cli_cmd) # --storage is used as a mitigation of # https://github.com/containers/libpod/issues/3906 # Also look https://bugzilla.redhat.com/show_bug.cgi?id=1747885 if CONTAINER_CLI == 'podman': - rm_cli_cmd.extend(['--storage']) - rm_cli_cmd.append(name) - stdout, stderr, retval = local_subprocess_call( - cmd=rm_cli_cmd - ) - if stdout: - LOG.debug(stdout) - if stderr and 'Error response from daemon' in stderr: - LOG.debug(stderr) + rm_storage_cli_cmd = [CLI_CMD, 'rm', '--storage'] + rm_storage_cli_cmd.append(name) + rm_process_call(rm_storage_cli_cmd) def mp_puppet_config(*args):