Skip to content

Commit ff8d35d

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Create exerciserc to configure exercises"
2 parents da6d4c8 + 51fb454 commit ff8d35d

File tree

9 files changed

+62
-59
lines changed

9 files changed

+62
-59
lines changed

HACKING.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,14 @@ Many scripts will utilize shared functions from the ``functions`` file. There a
4343
also rc files (``stackrc`` and ``openrc``) that are often included to set the primary
4444
configuration of the user environment::
4545

46-
# Use openrc + stackrc + localrc for settings
47-
pushd $(cd $(dirname "$0")/.. && pwd) >/dev/null
46+
# Keep track of the current devstack directory.
47+
TOP_DIR=$(cd $(dirname "$0") && pwd)
4848

4949
# Import common functions
50-
source ./functions
50+
source $TOP_DIR/functions
5151

5252
# Import configuration
53-
source ./openrc
54-
popd >/dev/null
53+
source $TOP_DIR/openrc
5554

5655
``stack.sh`` is a rather large monolithic script that flows through from beginning
5756
to end. There is a proposal to segment it to put the OpenStack projects
@@ -119,6 +118,12 @@ These scripts are executed serially by ``exercise.sh`` in testing situations.
119118
# an error. It is also useful for following allowing as the install occurs.
120119
set -o xtrace
121120

121+
* Settings and configuration are stored in ``exerciserc``, which must be
122+
sourced after ``openrc`` or ``stackrc``::
123+
124+
# Import exercise configuration
125+
source $TOP_DIR/exerciserc
126+
122127
* There are a couple of helper functions in the common ``functions`` sub-script
123128
that will check for non-zero exit codes and unset environment variables and
124129
print a message and exit the script. These should be called after most client

exerciserc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
#
3+
# source exerciserc
4+
#
5+
# Configure the DevStack exercise scripts
6+
# For best results, source this _after_ stackrc/localrc as it will set
7+
# values only if they are not already set.
8+
9+
# Max time to wait while vm goes from build to active state
10+
export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30}
11+
12+
# Max time to wait for proper IP association and dis-association.
13+
export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15}
14+
15+
# Max time till the vm is bootable
16+
export BOOT_TIMEOUT=${BOOT_TIMEOUT:-30}
17+
18+
# Max time from run instance command until it is running
19+
export RUNNING_TIMEOUT=${RUNNING_TIMEOUT:-$(($BOOT_TIMEOUT + $ACTIVE_TIMEOUT))}
20+
21+
# Max time to wait for a vm to terminate
22+
export TERMINATE_TIMEOUT=${TERMINATE_TIMEOUT:-30}

exercises/bundle.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ source $TOP_DIR/functions
2828
# Import EC2 configuration
2929
source $TOP_DIR/eucarc
3030

31+
# Import exercise configuration
32+
source $TOP_DIR/exerciserc
33+
3134
# Remove old certificates
3235
rm -f $TOP_DIR/cacert.pem
3336
rm -f $TOP_DIR/cert.pem

exercises/client-env.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ source $TOP_DIR/functions
2222
# Import configuration
2323
source $TOP_DIR/openrc
2424

25+
# Import exercise configuration
26+
source $TOP_DIR/exerciserc
27+
2528
# Unset all of the known NOVA_ vars
2629
unset NOVA_API_KEY
2730
unset NOVA_ENDPOINT_NAME

exercises/euca.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,8 @@ source $TOP_DIR/functions
2828
# Import EC2 configuration
2929
source $TOP_DIR/eucarc
3030

31-
# Max time to wait while vm goes from build to active state
32-
ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30}
33-
34-
# Max time till the vm is bootable
35-
BOOT_TIMEOUT=${BOOT_TIMEOUT:-30}
36-
37-
# Max time to wait for proper association and dis-association.
38-
ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15}
31+
# Import exercise configuration
32+
source $TOP_DIR/exerciserc
3933

4034
# Instance type to create
4135
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}

exercises/floating_ips.sh

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,18 @@ set -o xtrace
2323
# Settings
2424
# ========
2525

26-
# Use openrc + stackrc + localrc for settings
27-
pushd $(cd $(dirname "$0")/.. && pwd) >/dev/null
26+
# Keep track of the current directory
27+
EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
28+
TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
2829

2930
# Import common functions
30-
source ./functions
31+
source $TOP_DIR/functions
3132

3233
# Import configuration
33-
source ./openrc
34-
popd >/dev/null
34+
source $TOP_DIR/openrc
3535

36-
# Max time to wait while vm goes from build to active state
37-
ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30}
38-
39-
# Max time till the vm is bootable
40-
BOOT_TIMEOUT=${BOOT_TIMEOUT:-30}
41-
42-
# Max time to wait for proper association and dis-association.
43-
ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15}
36+
# Import exercise configuration
37+
source $TOP_DIR/exerciserc
4438

4539
# Instance type to create
4640
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}

exercises/swift.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,18 @@ set -o xtrace
1818
# Settings
1919
# ========
2020

21-
# Use openrc + stackrc + localrc for settings
22-
pushd $(cd $(dirname "$0")/.. && pwd) >/dev/null
21+
# Keep track of the current directory
22+
EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
23+
TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
2324

2425
# Import common functions
25-
source ./functions
26+
source $TOP_DIR/functions
2627

2728
# Import configuration
28-
source ./openrc
29-
popd >/dev/null
29+
source $TOP_DIR/openrc
30+
31+
# Import exercise configuration
32+
source $TOP_DIR/exerciserc
3033

3134
# Container name
3235
CONTAINER=ex-swift

exercises/volumes.sh

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,18 @@ set -o xtrace
1818
# Settings
1919
# ========
2020

21-
# Use openrc + stackrc + localrc for settings
22-
pushd $(cd $(dirname "$0")/.. && pwd) >/dev/null
21+
# Keep track of the current directory
22+
EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
23+
TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
2324

2425
# Import common functions
25-
source ./functions
26+
source $TOP_DIR/functions
2627

2728
# Import configuration
28-
source ./openrc
29-
popd >/dev/null
29+
source $TOP_DIR/openrc
3030

31-
# Max time to wait while vm goes from build to active state
32-
ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30}
33-
34-
# Max time till the vm is bootable
35-
BOOT_TIMEOUT=${BOOT_TIMEOUT:-30}
36-
37-
# Max time to wait for proper association and dis-association.
38-
ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15}
31+
# Import exercise configuration
32+
source $TOP_DIR/exerciserc
3933

4034
# Instance type to create
4135
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}

openrc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,3 @@ export COMPUTE_API_VERSION=${COMPUTE_API_VERSION:-$NOVA_VERSION}
6565
# set log level to DEBUG (helps debug issues)
6666
# export KEYSTONECLIENT_DEBUG=1
6767
# export NOVACLIENT_DEBUG=1
68-
69-
# Max time till the vm is bootable
70-
export BOOT_TIMEOUT=${BOOT_TIMEOUT:-30}
71-
72-
# Max time to wait while vm goes from build to active state
73-
export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30}
74-
75-
# Max time from run instance command until it is running
76-
export RUNNING_TIMEOUT=${RUNNING_TIMEOUT:-$(($BOOT_TIMEOUT + $ACTIVE_TIMEOUT))}
77-
78-
# Max time to wait for proper IP association and dis-association.
79-
export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15}
80-
81-
# Max time to wait for a vm to terminate
82-
export TERMINATE_TIMEOUT=${TERMINATE_TIMEOUT:-30}

0 commit comments

Comments
 (0)