diff --git a/bin/deploy b/bin/deploy index 52dc04fd..b8f0b64d 100755 --- a/bin/deploy +++ b/bin/deploy @@ -11,6 +11,7 @@ INCLUDE=$(dirname $(readlink -f $0)) ensure_command triton ensure_triton_cns_is_enabled +get_triton_details write_env_file triton env diff --git a/bin/setup_tools b/bin/setup_tools index a936c554..05c5ba3a 100644 --- a/bin/setup_tools +++ b/bin/setup_tools @@ -39,12 +39,17 @@ ensure_command() { } export -f ensure_command -ensure_docker_config_matches_triton_config_and_capture_triton_details() { - local docker_user=$(docker info 2>&1 | awk -F": " '/SDCAccount:/{print $2}') - local docker_dc=$(echo $DOCKER_HOST | awk -F"/" '{print $3}' | awk -F'.' '{print $1}') +get_triton_details() { TRITON_USER=$(triton profile get | awk -F": " '/account:/{print $2}') TRITON_DC=$(triton profile get | awk -F"/" '/url:/{print $3}' | awk -F'.' '{print $1}') TRITON_ACCOUNT=$(triton account get | awk -F": " '/id:/{print $2}') +} +export -f get_triton_details + +ensure_docker_config_matches_triton_config_and_capture_triton_details() { + local docker_user=$(docker info 2>&1 | awk -F": " '/SDCAccount:/{print $2}') + local docker_dc=$(echo $DOCKER_HOST | awk -F"/" '{print $3}' | awk -F'.' '{print $1}') + get_triton_details if [[ ! "$docker_user" = "$TRITON_USER" ]] || [[ ! "$docker_dc" = "$TRITON_DC" ]]; then echo "Docker user: ${docker_user}" echo "Triton user: ${TRITON_USER}"