From 3d5d3ff3ac22f550f0bd1d34a86fda7fdfdd1f25 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Sat, 10 Jul 2021 16:00:00 +0200 Subject: [PATCH] Attempt to unbork interactive breakage See https://git.autonomic.zone/coop-cloud/abra/issues/204. --- abra | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/abra b/abra index df39902..de6f129 100755 --- a/abra +++ b/abra @@ -1846,10 +1846,12 @@ sub_app_run(){ RUN_USER="-u $abra___user" fi + local -a ARGS="${ARGS:-""}" + if [ "$abra___no_tty" = "true" ]; then - ARGS="-i" + ARGS+=" -i" else - ARGS="-it" + ARGS+=" -it" fi CONTAINER=$(docker container ls --format "table {{.ID}},{{.Names}}" \ @@ -1862,11 +1864,15 @@ sub_app_run(){ debug "Using container ID ${CONTAINER}" - # 3wc: we want the "splitting" that shellcheck warns us about, so that -u and - # $RUN_USER aren't treated as a single argument: + # shellcheck disable=SC2145 + debug "Running command: docker exec $RUN_USER $ARGS $CONTAINER $@" + # shellcheck disable=SC2086 docker exec $RUN_USER $ARGS "$CONTAINER" "$@" + # shellcheck disable=SC2181 + if [[ $? != 0 ]]; then exit 1; fi + return } @@ -2153,14 +2159,14 @@ sub_recipe_lint() { fi # Check that at least one service has Traefik enabled - if $YQ e '.services.*.deploy.labels.[] == "traefik.enable=true"' "$compose_file" | grep -q true; then + if $YQ e '.services.*.deploy.labels.[] == "traefik.enable=true"' "$compose_file" | grep -q true; then info "Found at least one Traefik-enabled service" else warning "Can't find any Traefik-enabled service" fi - + # Healthcheck check (check) - if $YQ e -e '.services.*.healthcheck' "$compose_file" > /dev/null 2>&1; then + if $YQ e -e '.services.*.healthcheck' "$compose_file" > /dev/null 2>&1; then info "Found a healthcheck for at least one service." else warning "Can't find any healthchecks."