summaryrefslogtreecommitdiffstats
path: root/packages/base/src/files/bin
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2017-08-14 13:34:53 -0500
committerJorge Hernandez <jh1730@att.com>2017-08-14 13:43:07 -0500
commit483b87c8bee3c6911aa537b9c823a2c8d24bec80 (patch)
tree32b8422350a6060b9f26bc12d79b7fc3e0684653 /packages/base/src/files/bin
parent155b76589040d98d4a693d9d83dadb4f454cff5e (diff)
Support of DB-enabled features
Isolation and data migration support overall and on a per feature basis. policy@drools:/opt/app/policy$ policy.sh status [drools-pdp-controllers] L []: Policy Management (no pidfile) is NOT running 1 cron jobs installed. [features] name version status ---- ------- ------ eelf 1.1.0 disabled healthcheck 1.1.0 disabled session-persistence 1.1.0 enabled [migration] session-persistence: upgrade out-of-sync: 0 -> 201702 policy@drools:/opt/app/policy$ features enable session-persistence session-persistence: upgrade out-of-sync: 0 -> 201702 name version status ---- ------- ------ eelf 1.1.0 disabled healthcheck 1.1.0 disabled session-persistence 1.1.0 enabled policy@drools:/opt/app/policy$ db-migrator -s session-persistence -o upgrade upgrade: 0 -> 201702 > upgrade 201701-blah.upgrade.sql -------------- create table blah (a varchar(15), b varchar(20)) -------------- > upgrade 201702-blah2.upgrade.sql -------------- create table blah2 (a varchar(15), b varchar(20)) -------------- session-persistence: OK: upgrade (201702) policy@drools:/opt/app/policy$ db-migrator -s ALL -o report +---------------------+---------+ | name | version | +---------------------+---------+ | session-persistence | 201702 | +---------------------+---------+ +--------------------------+-----------+---------+---------------------+ | script | operation | success | atTime | +--------------------------+-----------+---------+---------------------+ | 201701-blah.upgrade.sql | upgrade | 1 | 2017-08-14 16:01:32 | | 201702-blah2.upgrade.sql | upgrade | 1 | 2017-08-14 16:01:32 | +--------------------------+-----------+---------+---------------------+ policy@drools:/opt/app/policy$ features disable session-persistence name version status ---- ------- ------ eelf 1.1.0 disabled healthcheck 1.1.0 disabled session-persistence 1.1.0 disabled policy@drools:/opt/app/policy$ db-migrator -s ALL -o downgrade downgrade: 201702 -> 0 > downgrade 201702-blah2.downgrade.sql -------------- drop table if exists blah2 -------------- > downgrade 201701-blah.downgrade.sql -------------- drop table if exists blah -------------- session-persistence: OK: downgrade (0) policy@drools:/opt/app/policy$ db-migrator -s ALL -o report +---------------------+---------+ | name | version | +---------------------+---------+ | session-persistence | 0 | +---------------------+---------+ +----------------------------+-----------+---------+---------------------+ | script | operation | success | atTime | +----------------------------+-----------+---------+---------------------+ | 201701-blah.upgrade.sql | upgrade | 1 | 2017-08-14 16:01:32 | | 201702-blah2.upgrade.sql | upgrade | 1 | 2017-08-14 16:01:32 | | 201701-blah.downgrade.sql | downgrade | 1 | 2017-08-14 16:13:49 | | 201702-blah2.downgrade.sql | downgrade | 1 | 2017-08-14 16:13:49 | +----------------------------+-----------+---------+---------------------+ session-persistence: OK @ 0 Change-Id: Ie185f5d7a8463cb349ac452d8c2b4b05928b3e56 Issue-ID: POLICY-96 Signed-off-by: Jorge Hernandez <jh1730@att.com>
Diffstat (limited to 'packages/base/src/files/bin')
-rw-r--r--packages/base/src/files/bin/policy.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/base/src/files/bin/policy.sh b/packages/base/src/files/bin/policy.sh
index 17ad2818..d5fabdec 100644
--- a/packages/base/src/files/bin/policy.sh
+++ b/packages/base/src/files/bin/policy.sh
@@ -66,10 +66,21 @@ function policy_status() {
set -x
fi
+ echo
policy_op "status"
NUM_CRONS=$(crontab -l 2> /dev/null | wc -l)
echo " ${NUM_CRONS} cron jobs installed."
+
+ echo
+ echo "[features]"
+ features status
+
+ local databases=$(ls -d "${POLICY_HOME}"/etc/db/migration/*/ 2> /dev/null)
+ if [[ -n ${databases} ]]; then
+ echo "[migration]"
+ db-migrator -s ALL -o ok
+ fi
}