Fix ready probe exit code 04/105004/2
authorandre.schmid <andre.schmid@est.tech>
Thu, 2 Apr 2020 13:39:47 +0000 (14:39 +0100)
committerOfir Sonsino <ofir.sonsino@intl.att.com>
Mon, 6 Apr 2020 06:29:26 +0000 (06:29 +0000)
The exit code ranges from 0 to 255, so it should not be
returning the http status code.
This was breaking the health check for the docker_run.sh
script, which was always getting a 0 return code in a
case of 503 http status for example.

Change-Id: I52b2923cdfc0d7389894917ccc4aa58468ac8bdc
Issue-ID: SDC-2867
Signed-off-by: andre.schmid <andre.schmid@est.tech>
catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ready-probe.sh.erb
catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/ready-probe.sh.erb
openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/ready-probe.sh.erb

index 35aef8e..9f6646d 100644 (file)
@@ -1,11 +1,9 @@
 #!/bin/bash
-health_Check_http_code=$(curl -k --max-time 5 -o /dev/null -w '%{http_code}' <%= @protocol %>://127.0.0.1:<%= @port %>/sdc2/rest/healthCheck)
+health_check_http_code=$(curl -k --max-time 5 -o /dev/null -w '%{http_code}' <%= @protocol %>://127.0.0.1:<%= @port %>/sdc2/rest/healthCheck)
 
-if [[ "$health_Check_http_code" -eq 200 ]]; then
-   exit 0
+if [[ "$health_check_http_code" -eq 200 ]]; then
+  exit 0
 else
-   exit $health_Check_http_code
+  echo "Health check http status: $health_check_http_code"
+  exit 1
 fi
-
-
-
index bad5f87..5b772ec 100644 (file)
@@ -1,8 +1,9 @@
 #!/bin/bash
-health_Check_http_code=$(curl -k --max-time 5 -o /dev/null -w '%{http_code}' <%= @protocol %>://127.0.0.1:<%= @port %>/sdc1/rest/healthCheck)
+health_check_http_code=$(curl -k --max-time 5 -o /dev/null -w '%{http_code}' <%= @protocol %>://127.0.0.1:<%= @port %>/sdc1/rest/healthCheck)
 
-if [[ "$health_Check_http_code" -eq 200 ]]; then
-   exit 0
+if [[ "$health_check_http_code" -eq 200 ]]; then
+  exit 0
 else
-   exit $health_Check_http_code
+  echo "Health check http status: $health_check_http_code"
+  exit 1
 fi
index cce9dfd..bea3c34 100644 (file)
@@ -1,7 +1,8 @@
 #!/bin/bash
-health_Check_http_code=$(curl -k --max-time 5 -o /dev/null -w '%{http_code}' -X GET --header "Accept: application/json" "<%= @protocol %>://127.0.0.1:<%= @port %>/onboarding-api/v1.0/healthcheck")
-if [[ "$health_Check_http_code" -eq 200 ]]; then
-   exit 0
+health_check_http_code=$(curl -k --max-time 5 -o /dev/null -w '%{http_code}' -X GET --header "Accept: application/json" "<%= @protocol %>://127.0.0.1:<%= @port %>/onboarding-api/v1.0/healthcheck")
+if [[ "$health_check_http_code" -eq 200 ]]; then
+  exit 0
 else
-   exit $health_Check_http_code
+  echo "Health check http status: $health_check_http_code"
+  exit 1
 fi