blob: b8e7c4d86f31b6d073f96ae56955dd679f33c622 [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
48function cleanup_XXXX() {
49 # 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
56function configure_XXXX() {
57 # sudo python setup.py deploy
58 # iniset $XXXX_CONF ...
59 # This function intentionally left blank
60 :
61}
62
63# init_XXXX() - Initialize databases, etc.
64function init_XXXX() {
65 # clean up from previous (possibly aborted) runs
66 # create required data files
67 :
68}
69
70# install_XXXX() - Collect source and prepare
71function install_XXXX() {
72 # git clone xxx
73 :
74}
75
76# start_XXXX() - Start running processes, including screen
Dean Troyer1de40cf2012-09-04 14:19:24 -050077function start_XXXX() {
Dean Troyer05f23652012-08-29 15:20:21 -050078 # screen_it XXXX "cd $XXXX_DIR && $XXXX_DIR/bin/XXXX-bin"
79 :
80}
81
82# stop_XXXX() - Stop running processes (non-screen)
83function stop_XXXX() {
84 # FIXME(dtroyer): stop only our screen screen window?
85 :
86}
Dean Troyer7903b792012-09-13 17:16:12 -050087
88# Restore xtrace
89$XTRACE
Sean Dague584d90e2013-03-29 14:34:53 -040090
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010091# Tell emacs to use shell-script-mode
92## Local variables:
93## mode: shell-script
94## End: