summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2021-05-10 15:14:37 +0000
committerGerrit Code Review <gerrit@onap.org>2021-05-10 15:14:37 +0000
commit2665208b9c4bd97d934058452c03c40924e5f22b (patch)
treebc21fad80e293c36ca2e681f2bdba4842f3b8545
parent8b5cef8b669aa8cc19fca12896e7d8435c45ed34 (diff)
parent02b765a3c9b854a24b85611f4950f9a57362b462 (diff)
Merge "support no https or authentication in telemetry"
-rw-r--r--policy-management/src/main/server-gen/bin/telemetry15
1 files changed, 13 insertions, 2 deletions
diff --git a/policy-management/src/main/server-gen/bin/telemetry b/policy-management/src/main/server-gen/bin/telemetry
index b17a95b8..454f11ed 100644
--- a/policy-management/src/main/server-gen/bin/telemetry
+++ b/policy-management/src/main/server-gen/bin/telemetry
@@ -33,13 +33,24 @@ if ! "${POLICY_HOME}"/bin/policy-management-controller status >/dev/null 2>&1; t
exit 2
fi
+CREDENTIALS=
+if [ -n "${TELEMETRY_USER}" ]; then
+ CREDENTIALS="--auth ${TELEMETRY_USER}:${TELEMETRY_PASSWORD}"
+fi
+
+PROTOCOL="http"
+if egrep "^http\.server\.services\..*CONFIG\.https.*=.*true" ${POLICY_HOME}/config/engine.properties; then
+ PROTOCOL="https"
+fi
+
if [ ! -r "${TELEMETRY_SPEC}" ]; then
echo "generating new spec .."
- if ! http --verify=no -a "${TELEMETRY_USER}:${TELEMETRY_PASSWORD}" https://localhost:9696/swagger.json >${TELEMETRY_SPEC} 2>/dev/null; then
+ if ! http --verify=no ${CREDENTIALS} "${PROTOCOL}"://localhost:9696/swagger.json >${TELEMETRY_SPEC} 2>/dev/null; then
echo "error: cannot generate telemetry spec"
rm -f ${TELEMETRY_SPEC} 2>/dev/null
exit 3
fi
fi
-exec http-prompt https://localhost:9696/policy/pdp/engine --verify=no --auth "${TELEMETRY_USER}:${TELEMETRY_PASSWORD}" --spec ${TELEMETRY_SPEC}
+exec http-prompt "${PROTOCOL}"://localhost:9696/policy/pdp/engine --verify=no ${CREDENTIALS} --spec ${TELEMETRY_SPEC}
+