blob: 2703788af438a6b4987b243fce15c957301e2ed4 [file] [log] [blame]
Sean Daguee263c822014-12-05 14:25:28 -05001#!/bin/bash
2#
Dean Troyer05f23652012-08-29 15:20:21 -05003# lib/template
4# Functions to control the configuration and operation of the XXXX service
5# <do not include this template file in ``stack.sh``!>
6
7# Dependencies:
Adam Spiers6a5aa7c2013-10-24 11:27:02 +01008#
9# - ``functions`` file
10# - ``SERVICE_{TENANT_NAME|PASSWORD}`` must be defined
11# - <list other global vars that are assumed to be defined>
Dean Troyer05f23652012-08-29 15:20:21 -050012
13# ``stack.sh`` calls the entry points in this order:
14#
Dean Troyere4fa7212014-01-15 15:04:49 -060015# - is_XXXX_enabled
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010016# - install_XXXX
17# - configure_XXXX
18# - init_XXXX
19# - start_XXXX
20# - stop_XXXX
21# - cleanup_XXXX
Dean Troyer05f23652012-08-29 15:20:21 -050022
Dean Troyer7903b792012-09-13 17:16:12 -050023# Save trace setting
24XTRACE=$(set +o | grep xtrace)
25set +o xtrace
Dean Troyer05f23652012-08-29 15:20:21 -050026
27
28# Defaults
29# --------
30
31# <define global variables here that belong to this project>
32
33# Set up default directories
34XXXX_DIR=$DEST/XXXX
35XXX_CONF_DIR=/etc/XXXX
36
37
38# Entry Points
39# ------------
40
Dean Troyere4fa7212014-01-15 15:04:49 -060041# Test if any XXXX services are enabled
42# is_XXXX_enabled
43function is_XXXX_enabled {
44 [[ ,${ENABLED_SERVICES} =~ ,"XX-" ]] && return 0
45 return 1
46}
47
Dean Troyer05f23652012-08-29 15:20:21 -050048# cleanup_XXXX() - Remove residual data files, anything left over from previous
49# runs that a clean run would need to clean up
Ian Wienandaee18c72014-02-21 15:35:08 +110050function cleanup_XXXX {
Dean Troyer05f23652012-08-29 15:20:21 -050051 # kill instances (nova)
52 # delete image files (glance)
53 # This function intentionally left blank
54 :
55}
56
57# configure_XXXX() - Set config files, create data dirs, etc
Ian Wienandaee18c72014-02-21 15:35:08 +110058function configure_XXXX {
Dean Troyer05f23652012-08-29 15:20:21 -050059 # sudo python setup.py deploy
60 # iniset $XXXX_CONF ...
61 # This function intentionally left blank
62 :
63}
64
65# init_XXXX() - Initialize databases, etc.
Ian Wienandaee18c72014-02-21 15:35:08 +110066function init_XXXX {
Dean Troyer05f23652012-08-29 15:20:21 -050067 # clean up from previous (possibly aborted) runs
68 # create required data files
69 :
70}
71
72# install_XXXX() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +110073function install_XXXX {
Dean Troyer05f23652012-08-29 15:20:21 -050074 # git clone xxx
75 :
76}
77
78# start_XXXX() - Start running processes, including screen
Ian Wienandaee18c72014-02-21 15:35:08 +110079function start_XXXX {
Chris Dent2f27a0e2014-09-09 13:46:02 +010080 # The quoted command must be a single command and not include an
81 # shell metacharacters, redirections or shell builtins.
82 # run_process XXXX "$XXXX_DIR/bin/XXXX-bin"
Dean Troyer05f23652012-08-29 15:20:21 -050083 :
84}
85
86# stop_XXXX() - Stop running processes (non-screen)
Ian Wienandaee18c72014-02-21 15:35:08 +110087function stop_XXXX {
Chris Dent2f27a0e2014-09-09 13:46:02 +010088 # for serv in serv-a serv-b; do
89 # stop_process $serv
90 # done
Dean Troyer05f23652012-08-29 15:20:21 -050091 :
92}
Dean Troyer7903b792012-09-13 17:16:12 -050093
94# Restore xtrace
95$XTRACE
Sean Dague584d90e2013-03-29 14:34:53 -040096
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010097# Tell emacs to use shell-script-mode
98## Local variables:
99## mode: shell-script
100## End: