Update ready-probe file 58/94658/2
authork.kedron <k.kedron@partner.samsung.com>
Thu, 29 Aug 2019 15:05:58 +0000 (17:05 +0200)
committerOfir Sonsino <ofir.sonsino@intl.att.com>
Fri, 30 Aug 2019 08:01:20 +0000 (08:01 +0000)
Update ready-probe file to support the https mode.

Issue-ID: SDC-2548
Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com>
Change-Id: I78328d7575d202d1d241785e07fb57573ffe2739

catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_prepareProbeFile.rb
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/recipes/FE_8_prepareProbeFile.rb
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/recipes/ON_6_prepareProbeFile.rb
openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/ready-probe.sh.erb

index 14d08be..8d42c26 100644 (file)
@@ -1,5 +1,17 @@
+if node[:disableHttp]
+  protocol = "https"
+  port = "#{node['BE'][:https_port]}"
+else
+  protocol = "http"
+  port = "#{node['BE'][:http_port]}"
+end
+
 template "/var/lib/ready-probe.sh" do
   source "ready-probe.sh.erb"
   sensitive true
   mode 0755
+  variables({
+    :protocol => protocol,
+    :port => port
+  })
 end
\ No newline at end of file
index 9da8431..b9eb9b0 100644 (file)
@@ -1,6 +1,6 @@
 #!/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 --max-time 5 -o /dev/null -w '%{http_code}' http://127.0.0.1:8080/sdc2/rest/healthCheck)
 if [[ "$health_Check_http_code" -eq 200 ]]; then
    exit 0
 else
index 14d08be..85ae99b 100644 (file)
@@ -1,5 +1,17 @@
+if node[:disableHttp]
+  protocol = "https"
+  port = "#{node['FE'][:https_port]}"
+else
+  protocol = "http"
+  port = "#{node['FE'][:http_port]}"
+end
+
 template "/var/lib/ready-probe.sh" do
   source "ready-probe.sh.erb"
   sensitive true
   mode 0755
+  variables({
+    :protocol => protocol,
+    :port => port
+  })
 end
\ No newline at end of file
index fed19d1..bad5f87 100644 (file)
@@ -1,9 +1,6 @@
 #!/bin/bash
-<% if node[:disableHttp] -%>
-health_Check_http_code=$(curl --max-time 5 -o /dev/null -w '%{http_code}' https://127.0.0.1:<%= @ssl_port %>/sdc1/rest/healthCheck)
-<% else %>
-health_Check_http_code=$(curl --max-time 5 -o /dev/null -w '%{http_code}' http://127.0.0.1:8181/sdc1/rest/healthCheck)
-<% end -%>
+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
 else
index edc8f9e..c8102e4 100644 (file)
@@ -1,9 +1,17 @@
+if node[:disableHttp]
+  protocol = "https"
+  port = "#{node['ONBOARDING_BE'][:https_port]}"
+else
+  protocol = "http"
+  port = "#{node['ONBOARDING_BE'][:http_port]}"
+end
+
 template "/var/lib/ready-probe.sh" do
   source "ready-probe.sh.erb"
   sensitive true
   mode 0755
   variables({
-        :onboard_port           => "#{node['ONBOARDING_BE'][:http_port]}",
-        :ssl_port               => "#{node['ONBOARDING_BE'][:https_port]}"
-     })
+    :protocol => protocol,
+    :port => port
+  })
 end
index 60148e0..bad5f87 100644 (file)
@@ -1,9 +1,6 @@
 #!/bin/bash
-<% if node[:disableHttp] -%>
-health_Check_http_code=$(curl --max-time 5 -o /dev/null -w '%{http_code}' -X GET --header "USER_ID: cs0008" --header "Accept: application/json" "https://127.0.0.1:<%= @ssl_port %>/onboarding-api/v1.0/healthcheck")
-<% else %>
-health_Check_http_code=$(curl --max-time 5 -o /dev/null -w '%{http_code}' -X GET --header "USER_ID: cs0008" --header "Accept: application/json" "http://127.0.0.1:<%= @onboard_port %>/onboarding-api/v1.0/healthcheck")
-<% end -%>
+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
 else