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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user