Fix preloading and parsing of arguments in the dind supervisor

We now remove the quotes from the image name in the ExecStartPre of the supervisor dind service,
so that the images are properly pulled.

We also fix the parsing of arguments in dindctl so that it correctly parses all of the arguments (the last one was being missed if it didn't have a parameter).

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
Pablo Carranza Velez 2017-07-26 14:44:09 -03:00
parent 8e1a38d610
commit 3771fd53ea
2 changed files with 5 additions and 3 deletions

View File

@ -52,7 +52,7 @@ function showHelp {
}
function parseOptions {
while [[ $# -gt 1 ]]
while [[ $# -ge 1 ]]
do
case $1 in
--mount-dist)
@ -98,7 +98,7 @@ function buildSupervisor {
function buildSupervisorSrc {
echo "Rebuilding supervisor source"
( cd "$SUPERVISOR_BASE_DIR" && npm run build )
( cd "$SUPERVISOR_BASE_DIR" && npm install && npm run build )
}
function refreshSupervisorSrc {
@ -121,6 +121,7 @@ function runDind {
SUPERVISOR_IMAGE="$SUPERVISOR_IMAGE" \
PASSWORDLESS_DROPBEAR="$PASSWORDLESS_DROPBEAR" \
SUPERVISOR_EXTRA_MOUNTS="$SUPERVISOR_EXTRA_MOUNTS" \
PRELOADED_IMAGE="$PRELOADED_IMAGE" \
IMAGE="$DIND_IMAGE" \
run-supervisor
}
@ -159,5 +160,6 @@ else
;;
*)
showHelp
;;
esac
fi

View File

@ -8,7 +8,7 @@ Before=openvpn-resin.service
WorkingDirectory=/usr/src/app
EnvironmentFile=/usr/src/app/config/env
EnvironmentFile=/usr/src/app/config/localenv
ExecStartPre=/bin/bash -c 'if [ "${PRELOADED_IMAGE}" == "true" ]; then /usr/bin/docker pull $(jq ".[0].imageId" ${APPS_PATH}); fi'
ExecStartPre=/bin/bash -c 'if [ "${PRELOADED_IMAGE}" == "true" ]; then /usr/bin/docker pull $(jq --raw-output ".[0].imageId" ${APPS_PATH}); fi'
ExecStartPre=/usr/bin/docker load --input /usr/src/supervisor-image.tar
ExecStartPre=-/usr/bin/docker kill resin_supervisor
ExecStartPre=-/usr/bin/docker rm resin_supervisor