From 1862d232cfba75de79624a79b62509dc29db23a2 Mon Sep 17 00:00:00 2001 From: Yasufumi Ogawa Date: Sat, 9 May 2020 15:14:48 +0000 Subject: [PATCH] Ignore errors when removing containers in DevStack We don't really care if on unstack the containers doesn't exist, so this commit makes us ignore those errors. Change-Id: I3345871e1308c961c375b5c3fac007e7c4d9e625 Closes-Bug: 1877531 (cherry picked from commit b7a19ece0409201e820754919c6fc3bdceb5dc16) --- devstack/plugin.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 7f6caf813..825995990 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -16,10 +16,19 @@ XTRACE=$(set +o | grep xtrace) set -o xtrace function container_runtime { + # Ignore error at killing/removing a container doesn't running to avoid + # unstack is terminated. + # TODO: Support for CRI-O if it's required. + local regex_cmds_ignore="(kill|rm)\s+" + if [[ ${CONTAINER_ENGINE} == 'crio' ]]; then sudo podman "$@" || die $LINENO "Error when running podman command" else - docker "$@" || die $LINENO "Error when running docker command" + if [[ $@ =~ $regex_cmds_ignore ]]; then + docker "$@" + else + docker "$@" || die $LINENO "Error when running docker command" + fi fi }