devstack plugin interface

adds interface files for freezer-web-ui to be installed
as a devstack plugin

Change-Id: If2005ea0ec5b1d9eecdaf89a2f014e0ae12ef4a8
NOTE: the freezer-web-ui plugin also installs the freezer client
This commit is contained in:
Fabrizio Vanni 2015-10-13 16:02:24 +01:00
parent 7b12891d57
commit ef91bf5647
6 changed files with 174 additions and 0 deletions

21
devstack/README.rst Normal file
View File

@ -0,0 +1,21 @@
This directory contains the Freezer Web UI DevStack plugin.
To configure the Freezer Web UI with DevStack, you will need to
enable this plugin by adding one line to the [[local|localrc]]
section of your local.conf file.
To enable the plugin, add a line of the form::
enable_plugin freezer-web-ui <GITURL> [GITREF]
where::
<GITURL> is the URL of a freezer-web-ui repository
[GITREF] is an optional git ref (branch/ref/tag). The default is master.
For example::
enable_plugin freezer-web-ui https://github.com/stackforge/freezer-web-ui.git master
For more information, see:
http://docs.openstack.org/developer/devstack/plugins.html

View File

@ -0,0 +1,14 @@
# The name of the dashboard to be added to HORIZON['dashboards']. Required.
DASHBOARD = 'freezer_ui'
# If set to True, this dashboard will not be added to the settings.
DISABLED = False
# Until there is a more elegant SYSPATH var scheme...
import sys
sys.path.append('%FREEZER_WEB_UI_DIR%')
# A list of applications to be added to INSTALLED_APPS.
ADD_INSTALLED_APPS = [
'freezer_ui',
]

View File

@ -0,0 +1,76 @@
#!/usr/bin/env bash
# Install the Freezer Web UI in Horizon
# add the following to localrc:
# enable_service freezer-web_ui
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Functions
# ---------
function is_freezer_web_ui_enabled {
[[ ,${ENABLED_SERVICES} =~ ,"freezer-web-ui" ]] && return 0
}
# executed during: clean
function cleanup_freezer_web_ui {
:
}
# executed during: stack install
function install_freezer_web_ui {
if is_service_enabled horizon; then
sudo -H -E pip install -e git+${FREEZER_WEB_UI_REPO}@${FREEZER_WEB_UI_BRANCH}#egg=freezer_web_ui-origin_${FREEZER_WEB_UI_BRANCH}
else
echo "Horizon dashboard disabled. Freezer Web UI will not be installed"
fi
}
# executed during: stack post-config
function configure_freezer_web_ui {
:
}
# executed during: stack extra
function init_freezer_web_ui {
if is_service_enabled horizon; then
local dashboard_enabled_50_freezer_py="$HORIZON_DIR/openstack_dashboard/enabled/_50_freezer.py"
sudo cp $FREEZER_WEB_UI_FILES/_50_freezer.py.template $dashboard_enabled_50_freezer_py
sudo sed -e "
s|%FREEZER_WEB_UI_DIR%|$FREEZER_WEB_UI_DIR|g
" -i $dashboard_enabled_50_freezer_py
fi
}
# executed during: stack extra
function start_freezer_web_ui {
restart_apache_server
}
# executed during: stop
function stop_freezer_web_ui {
:
}
function install_freezer_client {
sudo -H -E pip install -e git+${FREEZER_CLIENT_REPO}@${FREEZER_CLIENT_BRANCH}#egg=freezer-origin_${FREEZER_CLIENT_BRANCH}
}
# Restore xtrace
$XTRACE

View File

@ -0,0 +1,17 @@
[[local|localrc]]
disable_all_services
enable_plugin freezer-web-ui https://github.com/stackforge/freezer-web-ui.git master
enable_service rabbit mysql key
# This is to keep the token small for testing
KEYSTONE_TOKEN_FORMAT=UUID
# Modify passwords as needed
DATABASE_PASSWORD=secretdatabase
RABBIT_PASSWORD=secretrabbit
ADMIN_PASSWORD=secretadmin
SERVICE_PASSWORD=secretservice
SERVICE_TOKEN=111222333444

28
devstack/plugin.sh Normal file
View File

@ -0,0 +1,28 @@
# check for service enabled
if is_service_enabled freezer-web-ui; then
if [[ "$1" == "source" || "`type -t install_freezer_web_ui`" != 'function' ]]; then
# Initial source
source $FREEZER_WEB_UI_DIR/devstack/lib/freezer-web-ui
fi
if [[ "$1" == "stack" && "$2" == "install" ]]; then
echo_summary "Installing Freezer Web UI"
install_freezer_client
install_freezer_web_ui
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
echo_summary "Configuring Freezer Web UI"
configure_freezer_web_ui
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
echo_summary "Initializing Freezer Web UI"
init_freezer_web_ui
start_freezer_web_ui
fi
if [[ "$1" == "unstack" ]]; then
stop_freezer_web_ui
fi
if [[ "$1" == "clean" ]]; then
cleanup_freezer_web_ui
fi
fi

18
devstack/settings Normal file
View File

@ -0,0 +1,18 @@
# Defaults
# --------
# Set up default directories
FREEZER_WEB_UI_DIR=$DEST/freezer-web-ui
FREEZER_WEB_UI_FILES=${FREEZER_WEB_UI_DIR}/devstack/files
# Freezer Web UI repository
FREEZER_WEB_UI_REPO=${FREEZER_WEB_UI_REPO:-${GIT_BASE}/stackforge/freezer-web-ui.git}
FREEZER_WEB_UI_BRANCH=${FREEZER_WEB_UI_BRANCH:-master}
# Freezer client
FREEZER_CLIENT_REPO=${FREEZER_CLIENT_REPO:-${GIT_BASE}/stackforge/freezer.git}
FREEZER_CLIENT_DIR=$DEST/freezer
FREEZER_CLIENT_BRANCH=${FREEZER_CLIENT_BRANCH:-master}
enable_service freezer-web-ui freezer-client