From 777131d706b8379c5fb30f8161902d0388eb96bf Mon Sep 17 00:00:00 2001 From: Jorge Hernandez Date: Fri, 4 Jan 2019 14:43:44 -0600 Subject: Add tooling for drools policy developers This commit adds tooling to better support development activities for drools developers. 1. deploy artifacts to nexus or to local file repository on demand. It also allows to test on a single drools instance without the dependency on a nexus repo. 2. make installation configuration files conform to same convention (all upper case). Change-Id: Ia0a2fc25db2ef21b774a9eee4ed51d4b876a1993 Issue-ID: POLICY-1367 Signed-off-by: Jorge Hernandez --- .../src/main/server-gen/bin/deploy-artifact | 318 +++++++++++++++++++++ policy-management/src/main/server-gen/bin/features | 161 ++++++++++- .../server-gen/bin/policy-management-controller | 8 +- .../src/main/server-gen/bin/rest-add-controller | 10 +- .../src/main/server-gen/bin/rest-delete-controller | 8 +- .../src/main/server-gen/bin/telemetry | 6 +- 6 files changed, 486 insertions(+), 25 deletions(-) create mode 100644 policy-management/src/main/server-gen/bin/deploy-artifact (limited to 'policy-management/src/main/server-gen/bin') diff --git a/policy-management/src/main/server-gen/bin/deploy-artifact b/policy-management/src/main/server-gen/bin/deploy-artifact new file mode 100644 index 00000000..81f5f14c --- /dev/null +++ b/policy-management/src/main/server-gen/bin/deploy-artifact @@ -0,0 +1,318 @@ +#!/usr/bin/env bash + +# +# ============LICENSE_START======================================================= +# ONAP +# ================================================================================ +# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +############################################################################## +# Usage: usage +############################################################################## + +function usage() { + echo + echo -e "syntax: $(basename "$0") " + echo -e "\t [-f]" + echo -e "\t -a " + echo + echo -e "Options:" + echo -e "\t -f|--file-repo: deployment in the file repository" + echo -e "\t -a|--artifact: file artifact (jar or pom) to deploy" + echo + echo +} + +############################################################################## +# Usage: getPomAttributes ... +# +# This function performs simplistic parsing of a 'pom.xml' file, extracting +# the specified attributes (e.g. 'groupId', 'artifactId', 'version'). The +# attributes are returned as environment variables with the associated name +############################################################################## + +function getPomAttributes +{ + if [[ ${DEBUG} == y ]]; then + echo "-- ${FUNCNAME[0]} $* --" + set -x + fi + + local file="$1" + if [[ ! -f "${file}" ]]; then + echo "{1}: file does not exist" + return 1 + fi + + local tab=$'\t' rval=0 attr value + shift + + for attr in "$@" ; do + # Try to fetch the parameter associated with the 'pom.xml' file. + # Initially, the 'parent' element is excluded. If the desired + # parameter is not found, the 'parent' element is included in the + # second attempt. + value=$(sed -n \ + -e '//,/<\/parent>/d' \ + -e '//,/<\/dependencies>/d' \ + -e '//,/<\/build>/d' \ + -e '//,/<\/profiles>/d' \ + -e '//,/<\/description>/d' \ + -e '//,/<\/packaging>/d' \ + -e '//,/<\/modelVersion>/d' \ + -e '//,/<\/properties>/d' \ + -e "/^[ ${tab}]*<${attr}>\([^<]*\)<\/${attr}>.*/{s//\1/p;}" \ + <"${file}") + + if [[ "${value}" == "" ]]; then + # need to check parent for parameter + value=$(sed -n \ + -e '//,/<\/dependencies>/d' \ + -e '//,/<\/build>/d' \ + -e '//,/<\/profiles>/d' \ + -e '//,/<\/description>/d' \ + -e '//,/<\/packaging>/d' \ + -e '//,/<\/modelVersion>/d' \ + -e '//,/<\/properties>/d' \ + -e "/^[ ${tab}]*<${attr}>\([^<]*\)<\/${attr}>.*/{s//\1/p;}" \ + <"${file}") + + if [[ "${value}" == "" ]] ; then + echo "${file}: Can't determine ${attr}" >&2 + rval=1 + fi + fi + + # the following sets an environment variable with the name referred + # to by ${attr} + read "${attr}" <<<"${value}" + done + return ${rval} +} + + + +############################################################################## +# Usage: deployJar +# +# This function deploys a JAR file in a repository, as well as +# the 'pom.xml' member it contains. +################################################################# + +function deployJar +{ + if [[ ${DEBUG} == y ]]; then + echo "-- ${FUNCNAME[0]} $* --" + set -x + fi + + local artifact="${1}" + if [[ ! -f "${artifact}" ]]; then + echo "{artifact}: does not exist" + return 1 + fi + + local dir=$(mktemp -d) + local jar="${artifact##*/}" + + cp -p "${artifact}" "${dir}/${jar}" + + ( + local rval=0 + cd "${dir}" + + # determine name of 'pom' file within JAR + local pom=$(jar tf "${jar}" META-INF | grep '/pom\.xml$' | head -1) + if [[ -z ${pom} ]] ; then + echo "${jar}: Can't find 'pom.xml'" >&2 + return 1 + fi + jar xf "${jar}" "${pom}" + + local pomProperties=$(jar tf "${jar}" META-INF | grep '/pom\.properties$' | head -1) + if [[ -n ${pomProperties} ]] ; then + # extract pom file + jar xf "${jar}" "${pomProperties}" + source "${pomProperties}" + fi + + if [[ -z ${version} ]]; then + if ! getPomAttributes "${pom}" version ; then + echo "${pom}: Can't extract 'version' from pom" >&2 + return 2 + fi + fi + + local repoId repoUrl + if [[ "${version}" =~ SNAPSHOT ]] ; then + repoId=${SNAPSHOT_REPOSITORY_ID} + repoUrl=${SNAPSHOT_REPOSITORY_URL} + else + repoId=${RELEASE_REPOSITORY_ID} + repoUrl=${RELEASE_REPOSITORY_URL} + fi + + echo "${artifact}: Deploying JAR artifact to repository ${repoUrl} (${repoId})" + mvn deploy:deploy-file \ + -Dfile="${jar}" \ + -Dversion="${version}" \ + -Dpackaging=jar -DgeneratePom=false -DpomFile="${pom}" \ + -DrepositoryId="${repoId}" -Durl="${repoUrl}" \ + -DupdateReleaseInfo=true + + retval=${?} + rm -rf "${dir}" + + return ${retval} + ) +} + +############################################################################## +# Usage: deployPom +# +# This function deploys a 'pom.xml' file in the local repository +############################################################################## + +function deployPom +{ + if [[ ${DEBUG} == y ]]; then + echo "-- ${FUNCNAME[0]} $* --" + set -x + fi + + local file="${1}" + + if [[ -f ${file} ]]; then + return 1 + fi + + # need to extract attributes from POM file + if getPomAttributes "${1}" artifactId groupId version ; then + local repoId repoUrl + if [[ "${version}" =~ SNAPSHOT ]] ; then + repoId=${SNAPSHOT_REPOSITORY_ID} + repoUrl=${SNAPSHOT_REPOSITORY_URL} + else + repoId=${RELEASE_REPOSITORY_ID} + repoUrl=${RELEASE_REPOSITORY_URL} + fi + + echo "${file}: Deploying POM artifact to remote repository" + mvn deploy:deploy-file -Dfile="${file}" \ + -Dpackaging=pom -DgeneratePom=false \ + -DgroupId="${groupId}" \ + -DartifactId="${artifactId}" \ + -Dversion="${version}" \ + -DrepositoryId="${repoId}" -Durl="${repoUrl}" \ + -DupdateReleaseInfo=true + else + echo "${file}: Can't install pom due to missing attributes" >&2 + return 1 + fi +} + +############################################################################## +# Usage: deployArtifact +# +# This function deploys a maven artifacts in a repository +############################################################################## + +function deployArtifact +{ + if [[ ${DEBUG} == y ]]; then + echo "-- ${FUNCNAME[0]} $* --" + set -x + fi + + local file="${1}" + if [[ -z "${file}" ]]; then + echo "${file}: artifact file not provided" + return 1 + fi + + if [[ ! -f "${file}" ]]; then + echo "${file}: artifact file does not exist" + return 1 + fi + + case "${file}" in + *pom.xml|*.pom) + deployPom "${file}" + ;; + *.jar) + deployJar "${file}" + ;; + *) echo "${file}: Don't know how to install artifact" >&2 + return 2 + ;; + esac + + return ${?} +} + +############################################################################## +# MAIN +############################################################################## + +if [[ ${DEBUG} == y ]]; then + echo "-- $0 $* --" + set -x +fi + +retval=0 + +until [[ -z "$1" ]]; do + case $1 in + -a|--artifact) shift + ARTIFACT=$1 + ;; + -f|--file-repo) FILE_REPO_ID="file-repository" + FILE_REPO_URL="file:${HOME}/.m2/file-repository" + ;; + *) usage + exit 1 + ;; + esac + shift +done + +if [[ -z ${ARTIFACT} ]]; then + echo "No artifact file provided: $*" + usage + exit 1 +fi + +if [[ -n ${SNAPSHOT_REPOSITORY_URL} ]] && [[ -n ${RELEASE_REPOSITORY_URL} ]]; then + deployArtifact "${ARTIFACT}" + retval=${?} +else + FILE_REPO_ID="file-repository" + FILE_REPO_URL="file:${HOME}/.m2/file-repository" +fi + +if [[ -n ${FILE_REPO_ID} ]]; then + SNAPSHOT_REPOSITORY_ID="${FILE_REPO_ID}" + SNAPSHOT_REPOSITORY_URL="${FILE_REPO_URL}" + RELEASE_REPOSITORY_ID="${FILE_REPO_ID}" + RELEASE_REPOSITORY_URL="${FILE_REPO_URL}" + + mkdir -p "${FILE_REPO_URL#file:}" 2> /dev/null + deployArtifact "${ARTIFACT}" + retval=${?} +fi + +exit ${retval} diff --git a/policy-management/src/main/server-gen/bin/features b/policy-management/src/main/server-gen/bin/features index 13621aa4..676ce38d 100644 --- a/policy-management/src/main/server-gen/bin/features +++ b/policy-management/src/main/server-gen/bin/features @@ -1,10 +1,10 @@ -#! /bin/bash +#!/usr/bin/env bash ### # ============LICENSE_START======================================================= # ONAP POLICY # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -28,6 +28,8 @@ # L─ */ #     L─ [config]/ #     |   L─ + +#     L─ [bin]/ +#     |   L─ + #     L─ lib/ #     |  L─ [dependencies]/ #     |  | L─ + @@ -37,6 +39,8 @@ #     │   L─ /+ #     │  L─ sql/ #     │ L─ * +#     L─ [artifacts]/ +#      L─ + #     L─ [install] #      L─ [enable] #      L─ [disable] @@ -49,6 +53,8 @@ # [config]/ preferable named with "feature-" prefix to # precisely match it against the exact features, source code, and # associated wiki page for configuration details. +# [bin] feature bin directory that contains helper scripts for this feature +# [bin]/ preferable named with "feature-" prefix. # lib jar libraries needed by this features # lib/[dependencies] 3rd party jar dependencies not provided by base installation # of pdp-d that are necessary for to operate @@ -64,6 +70,9 @@ # [db]//sql/ for this feature sql scripts # upgrade scripts should be suffixed with ".upgrade.sql" # downgrade scripts should be suffixed with ".downgrade.sql" +# [artifacts] maven artifacts to be deployed in a maven repository. +# [artifacts]/ maven artifact with identifiable maven coordinates embedded +# in the artifact. # [install] custom installation directory where custom enable or disable scripts # and other free form data is included to be used for the enable and # and disable scripts. @@ -78,8 +87,10 @@ # Operations: # install: installs a feature # uninstall: uninstalls a feature -# enable : enables 1) dependencies, 2) configuration, 3) database, 4) feature, 5) customization -# disable: disables 1) dependencies, 2) configuration, 3) database, 4) feature, 6) customization +# enable : enables 1) dependencies, 2) configuration, 3) binaries 4) database, 5) artifacts, +# 6) feature, 7) customization. +# disable: disables 1) dependencies, 2) configuration, 3) binaries, 4) database, 5) feature, +# 6) customization # status : status of a feature # # 'enable' operation details: @@ -87,9 +98,11 @@ # 1. sets the symbolic link to the actual feature jar in pdp-d classpath ($POLICY_HOME/lib) # 2. sets symbolic links to feature dependencies in pdp-d classpath ($POLICY_HOME/lib) # 3. sets symbolic links to feature configuration in pdp-d configuration directory ($POLICY_HOME/config) -# 4. sets symbolic links to feature upgrade scripts and removes links to downgrade scripts (if any) +# 4. sets symbolic links to feature executables in pdp-d bin directory ($POLICY_HOME/bin) +# 5. sets symbolic links to feature upgrade scripts and removes links to downgrade scripts (if any) # in the pdp-d migration directory ($POLICY_HOME/etc/db/migration). -# 5. cd to the feature 'install' directory an executes (if exists) the 'enable' script to allow for specific +# 6. deploys any maven artifacts in the maven repositories in use (if any) +# 7. cd to the feature 'install' directory an executes (if exists) the 'enable' script to allow for specific # customizations for this feature. # # 'disable' operation details: @@ -97,15 +110,16 @@ # 1. removes the symbolic link to the actual feature jar in pdp-d classpath ($POLICY_HOME/lib) # 2. removes symbolic links to feature dependencies in pdp-d classpath ($POLICY_HOME/lib) # 3. removes symbolic links to feature configuration in pdp-d configuration directory ($POLICY_HOME/config) -# 4. removes symbolic links to feature upgrade scripts and sets links to downgrade scripts (if any) +# 4. removes symbolic links to feature executables in pdp-d bin directory ($POLICY_HOME/bin) +# 5. removes symbolic links to feature upgrade scripts and sets links to downgrade scripts (if any) # in the pdp-d migration directory ($POLICY_HOME/etc/db/migration). -# 5. cd to the feature 'install' directory an executes (if exists) the 'disable' script to allow for specific +# 6. cd to the feature 'install' directory an executes (if exists) the 'disable' script to allow for specific # customizations for this feature. # # Notes for DB enabled features: # A. Upgrade/Downgrade SQL File Name Format: # -[-description](.upgrade|.downgrade).sql -# B. See related tooling: db-migrator and policy +# B. See related tooling: db-migrator, deploy-artifact, and policy # # Example: # @@ -140,6 +154,7 @@ fi LIB=${POLICY_HOME}/lib CONFIG=${POLICY_HOME}/config +BIN=${POLICY_HOME}/bin DB=${POLICY_HOME}/etc/db/migration FEATURES=${POLICY_HOME}/features PROFILED=${POLICY_HOME}/etc/profile.d @@ -166,7 +181,9 @@ fi FEATURE_DEPS="lib/dependencies" FEATURE_LIB="lib/feature" FEATURE_CONFIG="config" +FEATURE_BIN="bin" FEATURE_INSTALL="install" +FEATURE_ARTIFACTS="artifacts" FEATURE_DB="db" FEATURE_SQL="sql" @@ -339,6 +356,36 @@ function enableConfigAnalysis () done } +# ########################################################## +# enableBinAnalysis (featureName): +# reports on potential dependency conflicts +# featureName: name of the feature +# ########################################################## +function enableBinAnalysis () +{ + if [[ ${DEBUG} == y ]]; then + echo "-- ${FUNCNAME[0]} $* --" + set -x + fi + + local featureName="$1" + local featureBins binPath binFileName + + if [[ -z ${featureName} ]]; then + echo "warning: no feature name" + return 1 + fi + + featureBins=$(ls "${FEATURES}"/"${featureName}"/"${FEATURE_BIN}"/ 2> /dev/null) + for binPath in ${featureBins}; do + binFileName=$(basename "${binPath}") + if [[ -e "${CONFIG}"/"${binFileName}" ]]; then + echo "error: a bin file of the same name is already in the base installation: ${binFileName}" + return 2 + fi + done +} + # ########################################################## # enableDbAnalysis (featureName): # reports on potential db access problems @@ -442,6 +489,33 @@ function enableFeatureConfig() fi } +# ########################################################## +# enableFeatureBin(featureName): +# enables feature binaries +# featureName: name of the feature +# ########################################################## +function enableFeatureBin() +{ + if [[ ${DEBUG} == y ]]; then + echo "-- ${FUNCNAME[0]} $* --" + set -x + fi + + local featureName="$1" + local featureBins featureBinPath + + if [[ -z ${featureName} ]]; then + echo "warning: no feature name" + return 1 + fi + + featureBins=$(find "${FEATURES}"/"${featureName}"/"${FEATURE_BIN}"/ -type f -maxdepth 1 2> /dev/null) + for featureBinPath in ${featureBins}; do + chmod u+x "${featureBinPath}" + ln -s -f "${featureBinPath}" "${BIN}/" + done +} + # ########################################################## # enableFeatureDbSchema(featureName): # enables feature DB Schema configuration @@ -532,6 +606,32 @@ function enableFeatureDb() done } +# ########################################################## +# enableFeatureArtifacts(featureName): +# deploys maven artifacts +# featureName: name of the feature +# ########################################################## +function enableFeatureArtifacts() +{ + if [[ ${DEBUG} == y ]]; then + echo "-- ${FUNCNAME[0]} $* --" + set -x + fi + + local featureName="$1" + local artifacts + + if [[ -z ${featureName} ]]; then + echo "warning: no feature name" + return 1 + fi + + artifacts=$(ls "${FEATURES}"/"${featureName}"/"${FEATURE_ARTIFACTS}"/* 2> /dev/null) + for artifactPath in ${artifacts}; do + deploy-artifact -f -a ${artifactPath} + done +} + # ########################################################## # customize(featureName): # executes customized script for an operation. @@ -603,6 +703,10 @@ function enableFeature() return "$?" fi + if ! enableBinAnalysis "${featureName}"; then + return "$?" + fi + if ! enableDbAnalysis "${featureName}"; then return "$?" fi @@ -619,10 +723,18 @@ function enableFeature() enableFeatureConfig "${featureName}" + # enable binaries + + enableFeatureBin "${featureName}" + # enable db enableFeatureDb "${featureName}" + # enable feature artifacts + + enableFeatureArtifacts "${featureName}" + # run custom enable if any customOpScript "${featureName}" "enable" @@ -721,6 +833,33 @@ function disableFeatureConfig() rm -f "${CONFIG}"/"${featureInstallConf}""${ENVIRONMENT_SUFFIX}" 2> /dev/null } +# ########################################################## +# disableFeatureBin(featureName): +# disables feature binaries +# featureName: name of the feature +# ########################################################## +function disableFeatureBin() +{ + if [[ ${DEBUG} == y ]]; then + echo "-- ${FUNCNAME[0]} $* --" + set -x + fi + + local featureName="$1" + local featureBins featureBinPath + + if [[ -z ${featureName} ]]; then + echo "warning: no feature name" + return 1 + fi + + featureBins=$(find "${FEATURES}"/"${featureName}"/"${FEATURE_BIN}"/ -type f -maxdepth 1 2> /dev/null) + for featureBinPath in ${featureBins}; do + binFileName=$(basename "${featureBinPath}") + rm -f "${BIN}"/"${binFileName}" 2> /dev/null + done +} + # ########################################################## # disableFeatureDbSchema(featureName, featureDbPath, schemaName): # disables feature db configuration for a schema @@ -846,6 +985,10 @@ function disableFeature() disableFeatureConfig "${featureName}" + # disable binaries if any + + disableFeatureBin "${featureName}" + # disable DB SQL scripts if any disableFeatureDb "${featureName}" diff --git a/policy-management/src/main/server-gen/bin/policy-management-controller b/policy-management/src/main/server-gen/bin/policy-management-controller index bad1783f..51d83d6a 100644 --- a/policy-management/src/main/server-gen/bin/policy-management-controller +++ b/policy-management/src/main/server-gen/bin/policy-management-controller @@ -66,7 +66,7 @@ function um_start() { # to subprocesses exec {cfg}>&- fi - nohup $JAVA_HOME/bin/java -Dkie.maven.settings.custom=$_DIR/config/kie_settings.xml -Dlog4j.configuration=file:$_DIR/config/log4j.properties -cp $_DIR/config:$_DIR/lib:$CP "${systemProperties[@]}" "$@" $CLASS > >( while read line; do echo "$(date): ${line}"; done > $_LOGS/$PNAME.out) 2> >( while read line; do echo "$(date): ${line}"; done > $_LOGS/$PNAME.err) & + nohup $JAVA_HOME/bin/java -cp $_DIR/config:$_DIR/lib:$CP "${systemProperties[@]}" "$@" $CLASS > >( while read line; do echo "$(date): ${line}"; done > $_LOGS/$PNAME.out) 2> >( while read line; do echo "$(date): ${line}"; done > $_LOGS/$PNAME.err) & _PID=$! echo $_PID > $_PIDFILE @@ -95,10 +95,10 @@ function um_stop() { echo $_STATUS remove_pid_file else - if [[ -n ${ENGINE_MANAGEMENT_PASSWORD} ]]; then - http_proxy= curl -k --silent --user ${ENGINE_MANAGEMENT_USER}:${ENGINE_MANAGEMENT_PASSWORD} -X DELETE https://localhost:${ENGINE_MANAGEMENT_PORT}/policy/pdp/engine -o /dev/null + if [[ -n ${TELEMETRY_PASSWORD} ]]; then + http_proxy= timeout 30 curl -k --silent --user ${TELEMETRY_USER}:${TELEMETRY_PASSWORD} -X DELETE https://localhost:${TELEMETRY_PORT}/policy/pdp/engine -o /dev/null else - http_proxy= curl -k --silent -X DELETE https://localhost:${ENGINE_MANAGEMENT_PORT}/policy/pdp/engine -o /dev/null + http_proxy= timeout 30 curl -k --silent -X DELETE https://localhost:${TELEMETRY_PORT}/policy/pdp/engine -o /dev/null fi sleep 5 echo "Stopping $SNAME..." diff --git a/policy-management/src/main/server-gen/bin/rest-add-controller b/policy-management/src/main/server-gen/bin/rest-add-controller index 0dd82eec..98b5702b 100644 --- a/policy-management/src/main/server-gen/bin/rest-add-controller +++ b/policy-management/src/main/server-gen/bin/rest-add-controller @@ -4,7 +4,7 @@ # ============LICENSE_START======================================================= # policy-management # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,12 +25,12 @@ source $POLICY_HOME/etc/profile.d/env.sh json=$1-controller.rest.json if [ -f ${json} ]; then - if [[ -n ${ENGINE_MANAGEMENT_PASSWORD} ]]; then - curl -k --silent --user ${ENGINE_MANAGEMENT_USER}:${ENGINE_MANAGEMENT_PASSWORD} -X POST --data @${json} --header "Content-Type: application/json" \ - https://localhost:${ENGINE_MANAGEMENT_PORT}/policy/pdp/engine/controllers + if [[ -n ${TELEMETRY_PASSWORD} ]]; then + curl -k --silent --user ${TELEMETRY_USER}:${TELEMETRY_PASSWORD} -X POST --data @${json} --header "Content-Type: application/json" \ + https://localhost:${TELEMETRY_PORT}/policy/pdp/engine/controllers else curl -k --silent -X POST --data @${json} --header "Content-Type: application/json" \ - https://localhost:${ENGINE_MANAGEMENT_PORT}/policy/pdp/engine/controllers + https://localhost:${TELEMETRY_PORT}/policy/pdp/engine/controllers fi else echo "Usage: rest-add-controller.sh closed-loop-sample|reporter|sepc|vsegw|.. (or any other config file ending with *-controller.rest.json)" diff --git a/policy-management/src/main/server-gen/bin/rest-delete-controller b/policy-management/src/main/server-gen/bin/rest-delete-controller index 03e67483..7a47c928 100644 --- a/policy-management/src/main/server-gen/bin/rest-delete-controller +++ b/policy-management/src/main/server-gen/bin/rest-delete-controller @@ -23,12 +23,12 @@ source $POLICY_HOME/etc/profile.d/env.sh if [[ -n $1 ]]; then - if [[ -n ${ENGINE_MANAGEMENT_PASSWORD} ]]; then - curl -k --silent --user ${ENGINE_MANAGEMENT_USER}:${ENGINE_MANAGEMENT_PASSWORD} -X DELETE --header "Content-Type: application/json" \ - https://localhost:${ENGINE_MANAGEMENT_PORT}/policy/pdp/engine/controllers/${1} + if [[ -n ${TELEMETRY_PASSWORD} ]]; then + curl -k --silent --user ${TELEMETRY_USER}:${TELEMETRY_PASSWORD} -X DELETE --header "Content-Type: application/json" \ + https://localhost:${TELEMETRY_PORT}/policy/pdp/engine/controllers/${1} else curl -k --silent -X DELETE --header "Content-Type: application/json" \ - https://localhost:${ENGINE_MANAGEMENT_PORT}/policy/pdp/engine/controllers/${1} + https://localhost:${TELEMETRY_PORT}/policy/pdp/engine/controllers/${1} fi echo exit diff --git a/policy-management/src/main/server-gen/bin/telemetry b/policy-management/src/main/server-gen/bin/telemetry index 7058d64c..37614b08 100644 --- a/policy-management/src/main/server-gen/bin/telemetry +++ b/policy-management/src/main/server-gen/bin/telemetry @@ -4,7 +4,7 @@ # ============LICENSE_START======================================================= # ONAP POLICY # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -35,10 +35,10 @@ fi if [[ ! -r ${TELEMETRY_SPEC} ]]; then echo "generating new spec .." - if ! http --verify=no -a "${ENGINE_MANAGEMENT_USER}:${ENGINE_MANAGEMENT_PASSWORD}" https://localhost:9696/swagger.json > ${TELEMETRY_SPEC} 2> /dev/null; then + if ! http --verify=no -a "${TELEMETRY_USER}:${TELEMETRY_PASSWORD}" https://localhost:9696/swagger.json > ${TELEMETRY_SPEC} 2> /dev/null; then echo "error: cannot generate telemetry spec" exit 3 fi fi -exec http-prompt https://localhost:9696/policy/pdp/engine --verify=no --auth "${ENGINE_MANAGEMENT_USER}:${ENGINE_MANAGEMENT_PASSWORD}" --spec ${TELEMETRY_SPEC} +exec http-prompt https://localhost:9696/policy/pdp/engine --verify=no --auth "${TELEMETRY_USER}:${TELEMETRY_PASSWORD}" --spec ${TELEMETRY_SPEC} -- cgit 1.2.3-korg