blob: e6d003284fe385264ece6e60508797b494d5cf2b [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 {
Clark Boylan902158b2017-05-30 14:11:09 -070044 [[ ,${DISABLED_SERVICES} =~ ,"XXXX" ]] && return 1
Dean Troyere4fa7212014-01-15 15:04:49 -060045 [[ ,${ENABLED_SERVICES} =~ ,"XX-" ]] && return 0
46 return 1
47}
48
Dean Troyer05f23652012-08-29 15:20:21 -050049# cleanup_XXXX() - Remove residual data files, anything left over from previous
50# runs that a clean run would need to clean up
Ian Wienandaee18c72014-02-21 15:35:08 +110051function cleanup_XXXX {
Dean Troyer05f23652012-08-29 15:20:21 -050052 # kill instances (nova)
53 # delete image files (glance)
54 # This function intentionally left blank
55 :
56}
57
58# configure_XXXX() - Set config files, create data dirs, etc
Ian Wienandaee18c72014-02-21 15:35:08 +110059function configure_XXXX {
Dean Troyer05f23652012-08-29 15:20:21 -050060 # sudo python setup.py deploy
61 # iniset $XXXX_CONF ...
62 # This function intentionally left blank
63 :
64}
65
Sean M. Collins2a242512016-05-03 09:03:09 -040066# create_XXXX_accounts() - Create required service accounts
67function create_XXXX_accounts {
68 :
69}
70
Dean Troyer05f23652012-08-29 15:20:21 -050071# init_XXXX() - Initialize databases, etc.
Ian Wienandaee18c72014-02-21 15:35:08 +110072function init_XXXX {
Dean Troyer05f23652012-08-29 15:20:21 -050073 # clean up from previous (possibly aborted) runs
74 # create required data files
75 :
76}
77
78# install_XXXX() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +110079function install_XXXX {
Dean Troyer05f23652012-08-29 15:20:21 -050080 # git clone xxx
81 :
82}
83
Sean Dague0eebeb42017-08-30 14:16:58 -040084# start_XXXX() - Start running processes
Ian Wienandaee18c72014-02-21 15:35:08 +110085function start_XXXX {
Chris Dent2f27a0e2014-09-09 13:46:02 +010086 # The quoted command must be a single command and not include an
87 # shell metacharacters, redirections or shell builtins.
88 # run_process XXXX "$XXXX_DIR/bin/XXXX-bin"
Dean Troyer05f23652012-08-29 15:20:21 -050089 :
90}
91
Sean Dague0eebeb42017-08-30 14:16:58 -040092# stop_XXXX() - Stop running processes
Ian Wienandaee18c72014-02-21 15:35:08 +110093function stop_XXXX {
Chris Dent2f27a0e2014-09-09 13:46:02 +010094 # for serv in serv-a serv-b; do
95 # stop_process $serv
96 # done
Dean Troyer05f23652012-08-29 15:20:21 -050097 :
98}
Dean Troyer7903b792012-09-13 17:16:12 -050099
100# Restore xtrace
Ian Wienand523f4882015-10-13 11:03:03 +1100101$_XTRACE_TEMPLATE
Sean Dague584d90e2013-03-29 14:34:53 -0400102
Adam Spiers6a5aa7c2013-10-24 11:27:02 +0100103# Tell emacs to use shell-script-mode
104## Local variables:
105## mode: shell-script
106## End: