Devstack gained the ablity to install all services in
a shared venv and became the default way to install
on all debian derived distor as part of
If9bc7ba45522189d03f19b86cb681bb150ee2f25
Today the plugin uses the system python3 executable
to invoke the manage.py untility to collect the static
resouces and compress them.
This change updates the devtack plugin to support
installation in the global venv.
When horizon is installed in a global venv the manage command
cannot import django or other depencies if invoked by
system python directly.
When installed in a global virutal environment,
devstack exports PYTHON to use the virtual env executeable.
```export PYTHON="$DEVSTACK_VENV/bin/python3"```
when a gobal venv is not enabled it export PYTHON
to use the correct system python
```export PYTHON=$(which python${PYTHON3_VERSION} 2>/dev/null)```
As such we can always rely on $PYTHON to contain the correct
execuable.
Closes-Bug: #2085487
Change-Id: I161db1e824ee2fafd305313a729795ed2ade634a
57 lines
1.8 KiB
Bash
57 lines
1.8 KiB
Bash
# plugin.sh - DevStack plugin.sh dispatch script watcher-dashboard
|
|
|
|
WATCHER_DASHBOARD_DIR=$(cd $(dirname $BASH_SOURCE)/.. && pwd)
|
|
|
|
function install_watcher_dashboard {
|
|
setup_develop ${WATCHER_DASHBOARD_DIR}
|
|
}
|
|
|
|
function configure_watcher_dashboard {
|
|
cp -a ${WATCHER_DASHBOARD_DIR}/watcher_dashboard/local/enabled/* ${DEST}/horizon/openstack_dashboard/local/enabled/
|
|
cp -a ${WATCHER_DASHBOARD_DIR}/watcher_dashboard/conf/* ${DEST}/horizon/openstack_dashboard/conf/
|
|
}
|
|
|
|
function init_watcher_dashboard {
|
|
# Setup alias for django-admin which could be different depending on distro
|
|
$PYTHON ${DEST}/horizon/manage.py collectstatic --noinput
|
|
$PYTHON ${DEST}/horizon/manage.py compress --force
|
|
}
|
|
|
|
# check for service enabled
|
|
if is_service_enabled watcher-dashboard; then
|
|
|
|
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
|
|
# Set up system services
|
|
# no-op
|
|
:
|
|
|
|
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
|
|
# Perform installation of service source
|
|
echo_summary "Installing Watcher Dashboard"
|
|
install_watcher_dashboard
|
|
|
|
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
|
# Configure after the other layer 1 and 2 services have been configured
|
|
echo_summary "Configurng Watcher Dashboard"
|
|
configure_watcher_dashboard
|
|
init_watcher_dashboard
|
|
|
|
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
|
# no-op
|
|
:
|
|
fi
|
|
|
|
if [[ "$1" == "unstack" ]]; then
|
|
rm -f ${DEST}/horizon/openstack_dashboard/local/enabled/_310*
|
|
rm -f ${DEST}/horizon/openstack_dashboard/conf/watcher*
|
|
|
|
fi
|
|
|
|
if [[ "$1" == "clean" ]]; then
|
|
# Remove state and transient data
|
|
# Remember clean.sh first calls unstack.sh
|
|
# no-op
|
|
:
|
|
fi
|
|
fi
|