Skip to content

Commit 768295e

Browse files
author
Dean Troyer
committed
Add mechanism to automatically load additional projects
This adds an extras.d directory to contain startup scripts that stack.sh runs automatically at the end. Similar to local.sh except the scripts are sourced into the stack.sh process rather than executed as a child process. This gives them complete access to the stack.sh environment. Convert Tempest to use this format as an example. Change-Id: Ibc95e6aaecf4211da948319eb452293ae4357780
1 parent 2d9a4e4 commit 768295e

4 files changed

Lines changed: 53 additions & 14 deletions

File tree

extras.d/80-tempest.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# tempest.sh - DevStack extras script
2+
3+
source $TOP_DIR/lib/tempest
4+
5+
if [[ "$1" == "stack" ]]; then
6+
# Configure Tempest last to ensure that the runtime configuration of
7+
# the various OpenStack services can be queried.
8+
if is_service_enabled tempest; then
9+
echo_summary "Configuring Tempest"
10+
install_tempest
11+
configure_tempest
12+
fi
13+
fi
14+
15+
if [[ "$1" == "unstack" ]]; then
16+
# no-op
17+
:
18+
fi
19+
20+

extras.d/README

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
The extras.d directory contains project initialization scripts to be
2+
sourced by stack.sh at the end of its run. This is expected to be
3+
used by external projects that want to be configured, started and
4+
stopped with DevStack.
5+
6+
Order is controlled by prefixing the script names with the a two digit
7+
sequence number. Script names must end with '.sh'. This provides a
8+
convenient way to disable scripts by simoy renaming them.
9+
10+
DevStack reserves the sequence numbers 00 through 09 and 90 through 99
11+
for its own use.
12+
13+
The scripts are called with an argument of 'stack' by stack.sh and
14+
with an argument of 'unstack' by unstack.sh.

stack.sh

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ source $TOP_DIR/lib/swift
321321
source $TOP_DIR/lib/ceilometer
322322
source $TOP_DIR/lib/heat
323323
source $TOP_DIR/lib/quantum
324-
source $TOP_DIR/lib/tempest
325324
source $TOP_DIR/lib/baremetal
326325

327326
# Set the destination directories for OpenStack projects
@@ -775,9 +774,6 @@ fi
775774
if is_service_enabled ceilometer; then
776775
install_ceilometer
777776
fi
778-
if is_service_enabled tempest; then
779-
install_tempest
780-
fi
781777

782778

783779
# Initialization
@@ -1314,16 +1310,6 @@ if is_service_enabled nova && is_baremetal; then
13141310
screen_it baremetal "nova-baremetal-deploy-helper"
13151311
fi
13161312

1317-
# Configure Tempest last to ensure that the runtime configuration of
1318-
# the various OpenStack services can be queried.
1319-
if is_service_enabled tempest; then
1320-
echo_summary "Configuring Tempest"
1321-
configure_tempest
1322-
echo '**************************************************'
1323-
echo_summary "Finished Configuring Tempest"
1324-
echo '**************************************************'
1325-
fi
1326-
13271313
# Save some values we generated for later use
13281314
CURRENT_RUN_TIME=$(date "+$TIMESTAMP_FORMAT")
13291315
echo "# $CURRENT_RUN_TIME" >$TOP_DIR/.stackenv
@@ -1333,6 +1319,16 @@ for i in BASE_SQL_CONN ENABLED_SERVICES HOST_IP LOGFILE \
13331319
done
13341320

13351321

1322+
# Run extras
1323+
# ==========
1324+
1325+
if [[ -d $TOP_DIR/extras.d ]]; then
1326+
for i in $TOP_DIR/extras.d/*.sh; do
1327+
[[ -r $i ]] && source $i stack
1328+
done
1329+
fi
1330+
1331+
13361332
# Run local script
13371333
# ================
13381334

unstack.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ if [[ "$1" == "--all" ]]; then
3939
UNSTACK_ALL=${UNSTACK_ALL:-1}
4040
fi
4141

42+
# Run extras
43+
# ==========
44+
45+
if [[ -d $TOP_DIR/extras.d ]]; then
46+
for i in $TOP_DIR/extras.d/*.sh; do
47+
[[ -r $i ]] && source $i unstack
48+
done
49+
fi
50+
4251
if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
4352
source $TOP_DIR/openrc
4453
teardown_quantum_debug

0 commit comments

Comments
 (0)