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.
This commit is contained in:
Ismo Puustinen 2018-02-01 17:59:57 +02:00
parent 551f73d324
commit 7a67246d47

View File

@ -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