902158bb8f
The old implementation for is_$service_enabled simply checked if any of the subservices were enabled and if so the service was considered to be enabled. This makes disabling services complicated as it means you have to list every single subservice which can and do change over time. Instead also check if the generic service name is in the disabled services list and if so don't treat the service as enabled. Change-Id: I7fe4dfca2cd9c15069d50a04161a29c5638291cb
107 lines
2.3 KiB
Bash
107 lines
2.3 KiB
Bash
#!/bin/bash
|
|
#
|
|
# lib/template
|
|
# Functions to control the configuration and operation of the XXXX service
|
|
# <do not include this template file in ``stack.sh``!>
|
|
|
|
# Dependencies:
|
|
#
|
|
# - ``functions`` file
|
|
# - ``SERVICE_{TENANT_NAME|PASSWORD}`` must be defined
|
|
# - <list other global vars that are assumed to be defined>
|
|
|
|
# ``stack.sh`` calls the entry points in this order:
|
|
#
|
|
# - is_XXXX_enabled
|
|
# - install_XXXX
|
|
# - configure_XXXX
|
|
# - init_XXXX
|
|
# - start_XXXX
|
|
# - stop_XXXX
|
|
# - cleanup_XXXX
|
|
|
|
# Save trace setting
|
|
_XTRACE_TEMPLATE=$(set +o | grep xtrace)
|
|
set +o xtrace
|
|
|
|
|
|
# Defaults
|
|
# --------
|
|
|
|
# <define global variables here that belong to this project>
|
|
|
|
# Set up default directories
|
|
XXXX_DIR=$DEST/XXXX
|
|
XXX_CONF_DIR=/etc/XXXX
|
|
|
|
|
|
# Functions
|
|
# ---------
|
|
|
|
# Test if any XXXX services are enabled
|
|
# is_XXXX_enabled
|
|
function is_XXXX_enabled {
|
|
[[ ,${DISABLED_SERVICES} =~ ,"XXXX" ]] && return 1
|
|
[[ ,${ENABLED_SERVICES} =~ ,"XX-" ]] && return 0
|
|
return 1
|
|
}
|
|
|
|
# cleanup_XXXX() - Remove residual data files, anything left over from previous
|
|
# runs that a clean run would need to clean up
|
|
function cleanup_XXXX {
|
|
# kill instances (nova)
|
|
# delete image files (glance)
|
|
# This function intentionally left blank
|
|
:
|
|
}
|
|
|
|
# configure_XXXX() - Set config files, create data dirs, etc
|
|
function configure_XXXX {
|
|
# sudo python setup.py deploy
|
|
# iniset $XXXX_CONF ...
|
|
# This function intentionally left blank
|
|
:
|
|
}
|
|
|
|
# create_XXXX_accounts() - Create required service accounts
|
|
function create_XXXX_accounts {
|
|
:
|
|
}
|
|
|
|
# init_XXXX() - Initialize databases, etc.
|
|
function init_XXXX {
|
|
# clean up from previous (possibly aborted) runs
|
|
# create required data files
|
|
:
|
|
}
|
|
|
|
# install_XXXX() - Collect source and prepare
|
|
function install_XXXX {
|
|
# git clone xxx
|
|
:
|
|
}
|
|
|
|
# start_XXXX() - Start running processes, including screen
|
|
function start_XXXX {
|
|
# The quoted command must be a single command and not include an
|
|
# shell metacharacters, redirections or shell builtins.
|
|
# run_process XXXX "$XXXX_DIR/bin/XXXX-bin"
|
|
:
|
|
}
|
|
|
|
# stop_XXXX() - Stop running processes (non-screen)
|
|
function stop_XXXX {
|
|
# for serv in serv-a serv-b; do
|
|
# stop_process $serv
|
|
# done
|
|
:
|
|
}
|
|
|
|
# Restore xtrace
|
|
$_XTRACE_TEMPLATE
|
|
|
|
# Tell emacs to use shell-script-mode
|
|
## Local variables:
|
|
## mode: shell-script
|
|
## End:
|