trove-dashboard/devstack/plugin.sh
Hirotaka Wakabayashi 0db9bad00c Calls manager.py by "$PYTHON" instead of "env python"
devstack should call manager.py by using $PYTHON variable that devstack
uses through openstack installation because manage.py uses python2
unless caller explicitly uses python3 interpreter.

Currently devstack fails with the following error message when devstack
uses python3::

  ++ /opt/stack/trove-dashboard/devstack/plugin.sh:configure_trove_dashboard:14 :   ../manage.py compilemessages
  Traceback (most recent call last):
    File "../manage.py", line 18, in <module>
      from django.core.management import execute_from_command_line
  ImportError: No module named django.core.management
  + /opt/stack/trove-dashboard/devstack/plugin.sh:configure_trove_dashboard:1 :   exit_trap

The reason for this error is no django.core.management library exists
in python2 site-packages because devstack installs the library as a
python3 library.

Story: 2007463
Task: 39148
Signed-off-by: Hirotaka Wakabayashi <hiwkby@yahoo.com>
Change-Id: Ia5f87788e117e9bbd9823afb6a8f139eb3ae5870
2020-03-31 07:17:34 +00:00

53 lines
1.6 KiB
Bash

# plugin.sh - DevStack plugin.sh dispatch script trove-dashboard
TROVE_DASHBOARD_DIR=$(cd $(dirname $BASH_SOURCE)/.. && pwd)
function install_trove_dashboard {
setup_develop ${TROVE_DASHBOARD_DIR}
}
function configure_trove_dashboard {
cp -a ${TROVE_DASHBOARD_DIR}/trove_dashboard/enabled/* ${DEST}/horizon/openstack_dashboard/local/enabled/
# NOTE: If locale directory does not exist, compilemessages will fail,
# so check for an existence of locale directory is required.
if [ -d ${TROVE_DASHBOARD_DIR}/trove_dashboard/locale ]; then
(cd ${TROVE_DASHBOARD_DIR}/trove_dashboard; DJANGO_SETTINGS_MODULE=openstack_dashboard.settings $PYTHON ../manage.py compilemessages)
fi
}
# check for service enabled
if is_service_enabled trove-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 Trove UI"
install_trove_dashboard
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
# Configure after the other layer 1 and 2 services have been configured
echo_summary "Configurng Trove UI"
configure_trove_dashboard
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# no-op
:
fi
if [[ "$1" == "unstack" ]]; then
# no-op
:
fi
if [[ "$1" == "clean" ]]; then
# Remove state and transient data
# Remember clean.sh first calls unstack.sh
# no-op
:
fi
fi