From 05cac00441113b4dde279c5328d6348e73bd133c Mon Sep 17 00:00:00 2001 From: Michel Hua Date: Sat, 24 Dec 2022 15:01:51 +0100 Subject: [PATCH] Add healthcheck and fix commands --- mwaa_cli.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mwaa_cli.sh b/mwaa_cli.sh index 10be656..3926497 100755 --- a/mwaa_cli.sh +++ b/mwaa_cli.sh @@ -67,10 +67,11 @@ function displayUsage { log "" log "Examples:" log "" + log "${PROMPT} ${PROGRAM_NAME} healthcheck" log "${PROMPT} ${PROGRAM_NAME} dags list" log "${PROMPT} ${PROGRAM_NAME} dags list-runs -d " - log "${PROMPT} ${PROGRAM_NAME} list_tasks " - log "${PROMPT} ${PROGRAM_NAME} trigger_dag " + log "${PROMPT} ${PROGRAM_NAME} dags show " + log "${PROMPT} ${PROGRAM_NAME} dags trigger " log "${PROMPT} ${PROGRAM_NAME} dags pause " log "${PROMPT} ${PROGRAM_NAME} dags unpause " log "" @@ -183,6 +184,12 @@ CLI_JSON=$(aws mwaa create-cli-token --name $MWAA_ENVIRONMENT --region $AWS_REGI CLI_TOKEN=$(echo $CLI_JSON | jq -r '.CliToken') WEB_SERVER_HOSTNAME=$(echo $CLI_JSON | jq -r '.WebServerHostname') +if [ "$AIRFLOW_CMD" = "healthcheck" ]; then + curl -s --request GET "https://$WEB_SERVER_HOSTNAME/health" + log "" + exit 0; +fi + # Trigger request of Airflow CLI from Amazon MWAA RESPONSE=$(curl -s --request POST "https://$WEB_SERVER_HOSTNAME/aws_mwaa/cli" \ --header "Authorization: Bearer $CLI_TOKEN" \