blob: f77409bd47448c24078999fce77f774f27490305 [file] [log] [blame]
Dean Troyer05f23652012-08-29 15:20:21 -05001# lib/template
2# Functions to control the configuration and operation of the XXXX service
3# <do not include this template file in ``stack.sh``!>
4
5# Dependencies:
Adam Spiers6a5aa7c2013-10-24 11:27:02 +01006#
7# - ``functions`` file
8# - ``SERVICE_{TENANT_NAME|PASSWORD}`` must be defined
9# - <list other global vars that are assumed to be defined>
Dean Troyer05f23652012-08-29 15:20:21 -050010
11# ``stack.sh`` calls the entry points in this order:
12#
Dean Troyere4fa7212014-01-15 15:04:49 -060013# - is_XXXX_enabled
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010014# - install_XXXX
15# - configure_XXXX
16# - init_XXXX
17# - start_XXXX
18# - stop_XXXX
19# - cleanup_XXXX
Dean Troyer05f23652012-08-29 15:20:21 -050020
Dean Troyer7903b792012-09-13 17:16:12 -050021# Save trace setting
22XTRACE=$(set +o | grep xtrace)
23set +o xtrace
Dean Troyer05f23652012-08-29 15:20:21 -050024
25
26# Defaults
27# --------
28
29# <define global variables here that belong to this project>
30
31# Set up default directories
32XXXX_DIR=$DEST/XXXX
33XXX_CONF_DIR=/etc/XXXX
34
35
36# Entry Points
37# ------------
38
Dean Troyere4fa7212014-01-15 15:04:49 -060039# Test if any XXXX services are enabled
40# is_XXXX_enabled
41function is_XXXX_enabled {
42 [[ ,${ENABLED_SERVICES} =~ ,"XX-" ]] && return 0
43 return 1
44}
45
Dean Troyer05f23652012-08-29 15:20:21 -050046# cleanup_XXXX() - Remove residual data files, anything left over from previous
47# runs that a clean run would need to clean up
Ian Wienandaee18c72014-02-21 15:35:08 +110048function cleanup_XXXX {
Dean Troyer05f23652012-08-29 15:20:21 -050049 # kill instances (nova)
50 # delete image files (glance)
51 # This function intentionally left blank
52 :
53}
54
55# configure_XXXX() - Set config files, create data dirs, etc
Ian Wienandaee18c72014-02-21 15:35:08 +110056function configure_XXXX {
Dean Troyer05f23652012-08-29 15:20:21 -050057 # sudo python setup.py deploy
58 # iniset $XXXX_CONF ...
59 # This function intentionally left blank
60 :
61}
62
63# init_XXXX() - Initialize databases, etc.
Ian Wienandaee18c72014-02-21 15:35:08 +110064function init_XXXX {
Dean Troyer05f23652012-08-29 15:20:21 -050065 # clean up from previous (possibly aborted) runs
66 # create required data files
67 :
68}
69
70# install_XXXX() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +110071function install_XXXX {
Dean Troyer05f23652012-08-29 15:20:21 -050072 # git clone xxx
73 :
74}
75
76# start_XXXX() - Start running processes, including screen
Ian Wienandaee18c72014-02-21 15:35:08 +110077function start_XXXX {
Chris Dent2f27a0e2014-09-09 13:46:02 +010078 # The quoted command must be a single command and not include an
79 # shell metacharacters, redirections or shell builtins.
80 # run_process XXXX "$XXXX_DIR/bin/XXXX-bin"
Dean Troyer05f23652012-08-29 15:20:21 -050081 :
82}
83
84# stop_XXXX() - Stop running processes (non-screen)
Ian Wienandaee18c72014-02-21 15:35:08 +110085function stop_XXXX {
Chris Dent2f27a0e2014-09-09 13:46:02 +010086 # for serv in serv-a serv-b; do
87 # stop_process $serv
88 # done
Dean Troyer05f23652012-08-29 15:20:21 -050089 :
90}
Dean Troyer7903b792012-09-13 17:16:12 -050091
92# Restore xtrace
93$XTRACE
Sean Dague584d90e2013-03-29 14:34:53 -040094
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010095# Tell emacs to use shell-script-mode
96## Local variables:
97## mode: shell-script
98## End: