Fix regression in removing containers in container-puppet.py

Commit 7282c11285 removed changes in
commit 529ad2d777 to call 'rm' twice,
i.e once without '--storage' and once with.

Change-Id: I2f6dac3e1c9842ccc1dc922d2be16a11a4927a11
Related-Bug: #1840691
This commit is contained in:
Rabi Mishra 2019-11-19 21:27:18 +05:30
parent b82bab09c9
commit 03f26d045e
1 changed files with 13 additions and 9 deletions

View File

@ -142,21 +142,25 @@ def rm_container(name):
if stderr: if stderr:
LOG.debug(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) LOG.info('Removing container: %s' % name)
rm_cli_cmd = [CLI_CMD, 'rm'] rm_cli_cmd = [CLI_CMD, 'rm']
rm_cli_cmd.append(name)
rm_process_call(rm_cli_cmd)
# --storage is used as a mitigation of # --storage is used as a mitigation of
# https://github.com/containers/libpod/issues/3906 # https://github.com/containers/libpod/issues/3906
# Also look https://bugzilla.redhat.com/show_bug.cgi?id=1747885 # Also look https://bugzilla.redhat.com/show_bug.cgi?id=1747885
if CONTAINER_CLI == 'podman': if CONTAINER_CLI == 'podman':
rm_cli_cmd.extend(['--storage']) rm_storage_cli_cmd = [CLI_CMD, 'rm', '--storage']
rm_cli_cmd.append(name) rm_storage_cli_cmd.append(name)
stdout, stderr, retval = local_subprocess_call( rm_process_call(rm_storage_cli_cmd)
cmd=rm_cli_cmd
)
if stdout:
LOG.debug(stdout)
if stderr and 'Error response from daemon' in stderr:
LOG.debug(stderr)
def mp_puppet_config(*args): def mp_puppet_config(*args):