summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvagrant <vv770d@att.com>2018-05-01 08:21:11 +0000
committervagrant <vv770d@att.com>2018-05-01 16:19:07 +0000
commitb51fd794c83c4694ebca5d07a2853d362d258b16 (patch)
treecc472b060e75006d18e2834e0f0d2e315a1bce32
parenta68c6a05004b2e0ed826228d8130daa03e1fd3f3 (diff)
config pull for non-policy blueprint deploy
Change-Id: Id91a9a6ca7eccf2462da0454fc87ad56a02c2dee Signed-off-by: Vijay Venkatesh Kumar <vv770d@att.com> Issue-ID: DCAEGEN2-480
-rwxr-xr-xtca-cdap-container/restart.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/tca-cdap-container/restart.sh b/tca-cdap-container/restart.sh
index a73ea8c..e962ee5 100755
--- a/tca-cdap-container/restart.sh
+++ b/tca-cdap-container/restart.sh
@@ -184,7 +184,18 @@ function tca_poll_policy {
CONFIG=$(echo $HTTP_BODY | jq .config.app_config)
PREF=$(echo $HTTP_BODY | jq .config.app_preferences)
POLICY=$(echo $HTTP_BODY | jq .policies.items[0].config.content.tca_policy)
- NEWPREF=$(echo $PREF | jq --arg tca_policy "$POLICY" '. + {$tca_policy}')
+
+ ## Check if policy content under tca_policy is returned null
+ ## null indicates no active policy flow; hence use configuration loaded
+ ## from blueprint
+
+ if [ $POLICY==null ]; then
+ # tca_policy through blueprint
+ NEWPREF=${PREF}
+ else
+ # tca_policy through active policy flow through PH
+ NEWPREF=$(echo $PREF | jq --arg tca_policy "$POLICY" '. + {$tca_policy}')
+ fi
NEWPREF=$(echo $NEWPREF | sed 's/\\n//g')
echo $CONFIG | jq . --sort-keys > "${TCA_CONF_TEMP}"
echo $NEWPREF | jq . --sort-keys > "${TCA_PREF_TEMP}"