blob: b92fb4048315ffa1796a4ed1bf8f5bb1907d0bed [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
Ian Wienand523f4882015-10-13 11:03:03 +110024_XTRACE_TEMPLATE=$(set +o | grep xtrace)
Dean Troyer7903b792012-09-13 17:16:12 -050025set +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
Sean M. Collins2a242512016-05-03 09:03:09 -040038# Functions
39# ---------
Dean Troyer05f23652012-08-29 15:20:21 -050040
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
Sean M. Collins2a242512016-05-03 09:03:09 -040065# create_XXXX_accounts() - Create required service accounts
66function create_XXXX_accounts {
67 :
68}
69
Dean Troyer05f23652012-08-29 15:20:21 -050070# init_XXXX() - Initialize databases, etc.
Ian Wienandaee18c72014-02-21 15:35:08 +110071function init_XXXX {
Dean Troyer05f23652012-08-29 15:20:21 -050072 # clean up from previous (possibly aborted) runs
73 # create required data files
74 :
75}
76
77# install_XXXX() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +110078function install_XXXX {
Dean Troyer05f23652012-08-29 15:20:21 -050079 # git clone xxx
80 :
81}
82
83# start_XXXX() - Start running processes, including screen
Ian Wienandaee18c72014-02-21 15:35:08 +110084function start_XXXX {
Chris Dent2f27a0e2014-09-09 13:46:02 +010085 # The quoted command must be a single command and not include an
86 # shell metacharacters, redirections or shell builtins.
87 # run_process XXXX "$XXXX_DIR/bin/XXXX-bin"
Dean Troyer05f23652012-08-29 15:20:21 -050088 :
89}
90
91# stop_XXXX() - Stop running processes (non-screen)
Ian Wienandaee18c72014-02-21 15:35:08 +110092function stop_XXXX {
Chris Dent2f27a0e2014-09-09 13:46:02 +010093 # for serv in serv-a serv-b; do
94 # stop_process $serv
95 # done
Dean Troyer05f23652012-08-29 15:20:21 -050096 :
97}
Dean Troyer7903b792012-09-13 17:16:12 -050098
99# Restore xtrace
Ian Wienand523f4882015-10-13 11:03:03 +1100100$_XTRACE_TEMPLATE
Sean Dague584d90e2013-03-29 14:34:53 -0400101
Adam Spiers6a5aa7c2013-10-24 11:27:02 +0100102# Tell emacs to use shell-script-mode
103## Local variables:
104## mode: shell-script
105## End: