From 7a67246d4766e92e410401f82ca9d9bc0723d03d Mon Sep 17 00:00:00 2001 From: Ismo Puustinen Date: Thu, 1 Feb 2018 17:59:57 +0200 Subject: [PATCH] build: fix a logic error in shell script. The right place to assign the "docker inspect" return value is outside of the subshell. The last return value was coming from something else than the expected command. --- build/common.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build/common.sh b/build/common.sh index 6e4d01e6954..c2066dccbae 100755 --- a/build/common.sh +++ b/build/common.sh @@ -501,9 +501,11 @@ function kube::build::ensure_data_container() { # If the data container exists AND exited successfully, we can use it. # Otherwise nuke it and start over. local ret=0 - local code=$(docker inspect \ + local code=0 + + code=$(docker inspect \ -f '{{.State.ExitCode}}' \ - "${KUBE_DATA_CONTAINER_NAME}" 2>/dev/null || ret=$?) + "${KUBE_DATA_CONTAINER_NAME}" 2>/dev/null) || ret=$? if [[ "${ret}" == 0 && "${code}" != 0 ]]; then kube::build::destroy_container "${KUBE_DATA_CONTAINER_NAME}" ret=1