Browse Source

fix: do not silently pass errors when populating environment variable for running hooks.

test
Valentin Lab 6 years ago
parent
commit
b92c1e5d42
  1. 11
      bin/compose-core

11
bin/compose-core

@ -1272,19 +1272,22 @@ run_service_hook () {
charm.has_hook "$charm" "$action" >/dev/null || continue charm.has_hook "$charm" "$action" >/dev/null || continue
PROJECT_NAME=$(get_default_project_name) || return 1 PROJECT_NAME=$(get_default_project_name) || return 1
export MASTER_BASE_SERVICE_NAME=$(get_top_master_service_for_service "$subservice") || return 1
export MASTER_BASE_CHARM_NAME=$(get_service_charm "$MASTER_BASE_SERVICE_NAME") || return 1
MASTER_BASE_SERVICE_NAME=$(get_top_master_service_for_service "$subservice") || return 1
MASTER_BASE_CHARM_NAME=$(get_service_charm "$MASTER_BASE_SERVICE_NAME") || return 1
DOCKER_BASE_IMAGE=$(service_base_docker_image "$MASTER_BASE_SERVICE_NAME") || return 1
Wrap -d "running $YELLOW$action$NORMAL hook of $DARKYELLOW$subservice$NORMAL in charm $DARKPINK$charm$NORMAL" <<EOF || return 1 Wrap -d "running $YELLOW$action$NORMAL hook of $DARKYELLOW$subservice$NORMAL in charm $DARKPINK$charm$NORMAL" <<EOF || return 1
export DOCKER_BASE_IMAGE="$DOCKER_BASE_IMAGE"
export SERVICE_NAME=$subservice export SERVICE_NAME=$subservice
export IMAGE_NAME=$(echo "${PROJECT_NAME}" | tr -d "_-")_\${SERVICE_NAME} export IMAGE_NAME=$(echo "${PROJECT_NAME}" | tr -d "_-")_\${SERVICE_NAME}
export CONTAINER_NAME=\${IMAGE_NAME}_1 export CONTAINER_NAME=\${IMAGE_NAME}_1
export CHARM_NAME="$charm" export CHARM_NAME="$charm"
export PROJECT_NAME=$PROJECT_NAME
export DOCKER_BASE_IMAGE=$(service_base_docker_image "$MASTER_BASE_SERVICE_NAME")
export PROJECT_NAME="$PROJECT_NAME"
export SERVICE_DATASTORE="$DATASTORE/$subservice" export SERVICE_DATASTORE="$DATASTORE/$subservice"
export SERVICE_CONFIGSTORE="$CONFIGSTORE/$subservice" export SERVICE_CONFIGSTORE="$CONFIGSTORE/$subservice"
export MASTER_BASE_SERVICE_NAME="$MASTER_BASE_SERVICE_NAME"
export MASTER_BASE_CHARM_NAME="$MASTER_BASE_CHARM_NAME"
charm.run_hook "$charm" "$action" charm.run_hook "$charm" "$action"

Loading…
Cancel
Save