Commit 837c96fd authored by Martin Peres's avatar Martin Peres
Browse files

initscript: be more resilient to containers returning non-0 exit code

parent 90bd4b83
...@@ -327,22 +327,23 @@ function start_container { ...@@ -327,22 +327,23 @@ function start_container {
sleep .1 sleep .1
log "About to start executing a container" log "About to start executing a container"
podman start -a "$container_id" exit_code=0
podman start -a "$container_id" || exit_code=$?
return $? return $exit_code
} }
function start_containers { function start_containers {
OLDIFS=$IFS IFS=$'\n' OLDIFS=$IFS IFS=$'\n'
for container_params in $(echo -e "$@"); do for container_params in $(echo -e "$@"); do
start_container "$container_params" exit_code=0
exit_code=$? start_container "$container_params" || exit_code=$?
if [ $exit_code -eq 0 ] ; then if [ $exit_code -eq 0 ] ; then
log "The container run successfully, load the next one!" log "The container run successfully, load the next one!"
else else
log "The container exited with error code $?, aborting..." log "The container exited with error code $?, aborting..."
return 1 return 0
fi fi
done done
IFS=$OLDIFS IFS=$OLDIFS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment