3 # ============LICENSE_START=======================================================
5 # ================================================================================
6 # Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
7 # ================================================================================
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 # ============LICENSE_END=========================================================
21 source ${POLICY_HOME}/etc/profile.d/env.sh
23 REST_TOOL="http-prompt"
24 TELEMETRY_SPEC="${POLICY_HOME}/config/telemetry-spec.json"
26 if ! type -p "${REST_TOOL}" >/dev/null 2>&1; then
27 echo "error: prerequisite software not found: http-prompt"
31 if ! "${POLICY_HOME}"/bin/policy-management-controller status >/dev/null 2>&1; then
32 echo "error: pdp-d is not running"
37 if [ -n "${TELEMETRY_USER}" ]; then
38 CREDENTIALS="--auth ${TELEMETRY_USER}:${TELEMETRY_PASSWORD}"
43 # use environment flag if set
44 if [ $HTTP_SERVER_HTTPS == "true" ]; then
48 # it takes precedence to have https explicitly set over the environment variable
49 if egrep "^http\.server\.services\..*CONFIG\.https.*=.*true" ${POLICY_HOME}/config/engine.properties; then
53 if [ ! -r "${TELEMETRY_SPEC}" ]; then
54 echo "generating new spec .."
55 if ! http --verify=no ${CREDENTIALS} "${PROTOCOL}"://localhost:9696/policy/pdp/engine/swagger >${TELEMETRY_SPEC} 2>/dev/null; then
56 echo "error: cannot generate telemetry spec"
57 rm -f ${TELEMETRY_SPEC} 2>/dev/null
62 exec http-prompt "${PROTOCOL}"://localhost:9696/policy/pdp/engine --verify=no ${CREDENTIALS} --spec ${TELEMETRY_SPEC}