From 9f8ec14dfe9dc01f7f567c2f473f260a25d0fac2 Mon Sep 17 00:00:00 2001 From: Brianna Poulos Date: Tue, 16 Jan 2018 12:05:30 -0500 Subject: [PATCH] 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 --- README.rst | 4 +-- devstack/README.rst | 19 ++++++++++++++ devstack/plugin.sh | 61 +++++++++++++++++++++++++++++++++++++++++++++ devstack/settings | 3 +++ 4 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 devstack/README.rst create mode 100644 devstack/plugin.sh create mode 100644 devstack/settings diff --git a/README.rst b/README.rst index ca48fef..686c383 100644 --- a/README.rst +++ b/README.rst @@ -19,7 +19,7 @@ Enabling in DevStack Add this repo as an external repository into your ``local.conf`` file:: [[local|localrc]] - enable_plugin castellan_ui https://github.com/openstack/castellan-ui + enable_plugin castellan-ui https://github.com/openstack/castellan-ui 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 to have the application start on port 8080 and the horizon dashboard will be -available in your browser at http://localhost:8080/ \ No newline at end of file +available in your browser at http://localhost:8080/ diff --git a/devstack/README.rst b/devstack/README.rst new file mode 100644 index 0000000..54336ab --- /dev/null +++ b/devstack/README.rst @@ -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 +`__. + +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 + diff --git a/devstack/plugin.sh b/devstack/plugin.sh new file mode 100644 index 0000000..9312e4c --- /dev/null +++ b/devstack/plugin.sh @@ -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 + diff --git a/devstack/settings b/devstack/settings new file mode 100644 index 0000000..4ace184 --- /dev/null +++ b/devstack/settings @@ -0,0 +1,3 @@ +# settings file for castellan-ui plugin +define_plugin castellan-ui +enable_service castellan-ui