Have Trove plugin install dashboard

At present if the Trove plugin is enabled and Horizon is enabled,
the Trove dashboard still needs to be enabled (which is currently
done by redstack). This should be handled by the Trove plugin
itself.

With this fix, if Trove and Horizon are installed the dashboard
will be automatically set up.

Some variable names were modified slightly as well to bring
them in line with the rest.

The cleanup code was also moved to the 'stop' section, which is
where it probably belonged right from the beginning.

Depends-On: I71cf27a57e8d2cd141928f26ac01bd5ca14c723f
Change-Id: I6586801bff4282e3bbf11e45e4f171fffcab285e
Partial-Bug: #1593806
This commit is contained in:
Peter Stachowski 2016-06-17 13:51:38 -04:00
parent 4f888ddfa3
commit bd76eda2a3
2 changed files with 34 additions and 7 deletions

View File

@ -73,9 +73,19 @@ function create_trove_accounts {
# cleanup_trove() - Remove residual data files, anything left over from previous # cleanup_trove() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up # runs that a clean run would need to clean up
function cleanup_trove { function cleanup_trove {
#Clean up dirs # Clean up dirs
rm -fr $TROVE_AUTH_CACHE_DIR/* rm -fr $TROVE_AUTH_CACHE_DIR/*
rm -fr $TROVE_CONF_DIR/* rm -fr $TROVE_CONF_DIR/*
if is_service_enabled horizon; then
cleanup_trove_dashboard
fi
}
# cleanup_trove_dashboard() - Remove Trove dashboard files from Horizon
function cleanup_trove_dashboard {
rm -f $HORIZON_DIR/openstack_dashboard/local/enabled/_17*database*.py
} }
@ -181,13 +191,24 @@ function configure_trove {
# install_trove() - Collect source and prepare # install_trove() - Collect source and prepare
function install_trove { function install_trove {
setup_develop $TROVE_DIR setup_develop $TROVE_DIR
if is_service_enabled horizon; then
install_trove_dashboard
fi
}
# install_trove_dashboard() - Collect source and prepare
function install_trove_dashboard {
git_clone $TROVE_DASHBOARD_REPO $TROVE_DASHBOARD_DIR $TROVE_DASHBOARD_BRANCH
setup_develop $TROVE_DASHBOARD_DIR
cp $TROVE_DASHBOARD_DIR/trove_dashboard/enabled/_17*database*.py $HORIZON_DIR/openstack_dashboard/local/enabled
} }
# install_python_troveclient() - Collect source and prepare # install_python_troveclient() - Collect source and prepare
function install_python_troveclient { function install_python_troveclient {
if use_library_from_git "python-troveclient"; then if use_library_from_git "python-troveclient"; then
git_clone $TROVECLIENT_REPO $TROVECLIENT_DIR $TROVECLIENT_BRANCH git_clone $TROVE_CLIENT_REPO $TROVE_CLIENT_DIR $TROVE_CLIENT_BRANCH
setup_develop $TROVECLIENT_DIR setup_develop $TROVE_CLIENT_DIR
fi fi
} }
@ -285,7 +306,6 @@ if is_service_enabled trove; then
echo_summary "Installing Trove" echo_summary "Installing Trove"
install_trove install_trove
install_python_troveclient install_python_troveclient
cleanup_trove
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
echo_summary "Configuring Trove" echo_summary "Configuring Trove"
configure_trove configure_trove
@ -315,6 +335,7 @@ if is_service_enabled trove; then
if [[ "$1" == "unstack" ]]; then if [[ "$1" == "unstack" ]]; then
stop_trove stop_trove
cleanup_trove
fi fi
fi fi

View File

@ -3,10 +3,16 @@
# Set up default directories # Set up default directories
TROVE_DIR=${TROVE_DIR:-${DEST}/trove} TROVE_DIR=${TROVE_DIR:-${DEST}/trove}
TROVE_REPO=${TROVE_REPO:-${GIT_BASE}/openstack/trove.git}
TROVE_BRANCH=${TROVE_BRANCH:-master}
TROVECLIENT_DIR=${TROVECLIENT_DIR:-${DEST}/python-troveclient} TROVE_CLIENT_DIR=${TROVE_CLIENT_DIR:-${TROVECLIENT_DIR:-${DEST}/python-troveclient}}
TROVECLIENT_REPO=${TROVECLIENT_REPO:-${GIT_BASE}/openstack/python-troveclient.git} TROVE_CLIENT_REPO=${TROVE_CLIENT_REPO:-${TROVECLIENT_REPO:-${GIT_BASE}/openstack/python-troveclient.git}}
TROVECLIENT_BRANCH=${TROVECLIENT_BRANCH:-master} TROVE_CLIENT_BRANCH=${TROVE_CLIENT_BRANCH:-${TROVECLIENT_BRANCH:-master}}
TROVE_DASHBOARD_DIR=${TROVE_DASHBOARD_DIR:-${DEST}/trove-dashboard}
TROVE_DASHBOARD_REPO=${TROVE_DASHBOARD_REPO:-${GIT_BASE}/openstack/trove-dashboard.git}
TROVE_DASHBOARD_BRANCH=${TROVE_DASHBOARD_BRANCH:-master}
# Set up configuration directory and files # Set up configuration directory and files
TROVE_CONF_DIR=${TROVE_CONF_DIR:-/etc/trove} TROVE_CONF_DIR=${TROVE_CONF_DIR:-/etc/trove}