Add devstack directory

Add a devstack directory to the castellan-ui
plugin so that it can be installed in devstack
using the enable_plugin line.

Change-Id: Ic08f2fb188c84ef9d44ab394e5677b780f0e3b14
This commit is contained in:
Brianna Poulos 2018-01-16 12:05:30 -05:00
parent 72a202fb63
commit 9f8ec14dfe
4 changed files with 85 additions and 2 deletions

View File

@ -19,7 +19,7 @@ Enabling in DevStack
Add this repo as an external repository into your ``local.conf`` file:: Add this repo as an external repository into your ``local.conf`` file::
[[local|localrc]] [[local|localrc]]
enable_plugin castellan_ui https://github.com/openstack/castellan-ui enable_plugin castellan-ui https://github.com/openstack/castellan-ui
Manual Installation Manual Installation
------------------- -------------------
@ -61,4 +61,4 @@ To run horizon with the newly enabled Castellan UI plugin run::
./run_tests.sh --runserver 0.0.0.0:8080 ./run_tests.sh --runserver 0.0.0.0:8080
to have the application start on port 8080 and the horizon dashboard will be to have the application start on port 8080 and the horizon dashboard will be
available in your browser at http://localhost:8080/ available in your browser at http://localhost:8080/

19
devstack/README.rst Normal file
View File

@ -0,0 +1,19 @@
================================
DevStack plugin for castellan-ui
================================
This is setup as a DevStack plugin.
For more information on DevStack plugins,
see the `DevStack Plugins documentation
<https://docs.openstack.org/devstack/latest/plugins.html>`__.
How to enable castellan-ui dashboard
------------------------------------
Add this repo as an external repository into your ``local.conf`` file::
.. code-block:: none
[[local|localrc]]
enable_plugin castellan-ui https://github.com/openstack/castellan-ui

61
devstack/plugin.sh Normal file
View File

@ -0,0 +1,61 @@
# plugin.sh - DevStack plugin.sh dispatch script castellan-ui
CASTELLAN_UI_DIR=$(cd $(dirname $BASH_SOURCE)/.. && pwd)
CASTELLAN_UI_ENABLED_DIR=$CASTELLAN_UI_DIR/castellan_ui/enabled
HORIZON_ENABLED_DIR=$DEST/horizon/openstack_dashboard/local/enabled
function install_castellan_ui {
setup_develop $CASTELLAN_UI_DIR
}
function configure_castellan_ui {
cp -a $CASTELLAN_UI_ENABLED_DIR/_[0-9]*.py $HORIZON_ENABLED_DIR
# NOTE: If locale directory does not exist, compilemessages will fail,
# so check for an existence of locale directory is required.
if [ -d $CASTELLAN_UI_DIR/castellan_ui/locale ]; then
(cd $CASTELLAN_UI_DIR/castellan_ui; \
DJANGO_SETTINGS_MODULE=openstack_dashboard.settings ../manage.py compilemessages)
fi
}
# check for service enabled
if is_service_enabled castellan-ui; then
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
# Set up system services
echo_summary "Configuring Castellan UI"
# no-op
:
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
# Perform installation of service source
echo_summary "Installing Castellan UI"
install_castellan_ui
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
# Configure after the other layer 1 and 2 services have been configured
echo_summary "Configurng Castellan UI"
configure_castellan_ui
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# no-op
:
fi
if [[ "$1" == "unstack" ]]; then
# Remove enabled file(s)
for _enabled_file in $CASTELLAN_UI_ENABLED_DIR/_[0-9]*.py; do
_enabled_basename=$(basename $_enabled_file .py)
rm -f $HORIZON_ENABLED_DIR/${_enabled_basename}.py*
rm -f $HORIZON_ENABLED_DIR/__pycache__/${_enabled_basename}.*pyc
done
fi
if [[ "$1" == "clean" ]]; then
# Remove state and transient data
# Remember clean.sh first calls unstack.sh
# no-op
:
fi
fi

3
devstack/settings Normal file
View File

@ -0,0 +1,3 @@
# settings file for castellan-ui plugin
define_plugin castellan-ui
enable_service castellan-ui