@@ -49,10 +49,6 @@ level.
4949``doc `` - Contains the Sphinx source for the documentation.
5050A complete doc build can be run with ``tox -edocs ``.
5151
52- ``exercises `` - Contains the test scripts used to sanity-check and
53- demonstrate some OpenStack functions. These scripts know how to exit
54- early or skip services that are not enabled.
55-
5652``extras.d `` - Contains the dispatch scripts called by the hooks in
5753``stack.sh ``, ``unstack.sh `` and ``clean.sh ``. See :doc: `the plugins
5854docs <plugins>` for more information.
@@ -182,88 +178,6 @@ The complete docs build is also handled with <code>tox -edocs</code> per the
182178OpenStack project standard.
183179
184180
185- Exercises
186- ---------
187-
188- The scripts in the exercises directory are meant to 1) perform basic operational
189- checks on certain aspects of OpenStack; and b) document the use of the
190- OpenStack command-line clients.
191-
192- In addition to the guidelines above, exercise scripts MUST follow the structure
193- outlined here. ``swift.sh `` is perhaps the clearest example of these guidelines.
194- These scripts are executed serially by ``exercise.sh `` in testing situations.
195-
196- * Begin and end with a banner that stands out in a sea of script logs to aid
197- in debugging failures, particularly in automated testing situations. If the
198- end banner is not displayed, the script ended prematurely and can be assumed
199- to have failed.
200-
201- ::
202-
203- echo "**************************************************"
204- echo "Begin DevStack Exercise: $0"
205- echo "**************************************************"
206- ...
207- set +o xtrace
208- echo "**************************************************"
209- echo "End DevStack Exercise: $0"
210- echo "**************************************************"
211-
212- * The scripts will generally have the shell ``xtrace `` attribute set to display
213- the actual commands being executed, and the ``errexit `` attribute set to exit
214- the script on non-zero exit codes::
215-
216- # This script exits on an error so that errors don't compound and you see
217- # only the first error that occurred.
218- set -o errexit
219-
220- # Print the commands being run so that we can see the command that triggers
221- # an error. It is also useful for following as the install occurs.
222- set -o xtrace
223-
224- * Settings and configuration are stored in ``exerciserc ``, which must be
225- sourced after ``openrc `` or ``stackrc ``::
226-
227- # Import exercise configuration
228- source $TOP_DIR/exerciserc
229-
230- * There are a couple of helper functions in the common ``functions `` sub-script
231- that will check for non-zero exit codes and unset environment variables and
232- print a message and exit the script. These should be called after most client
233- commands that are not otherwise checked to short-circuit long timeouts
234- (instance boot failure, for example)::
235-
236- swift post $CONTAINER
237- die_if_error "Failure creating container $CONTAINER"
238-
239- FLOATING_IP=`euca-allocate-address | cut -f2`
240- die_if_not_set FLOATING_IP "Failure allocating floating IP"
241-
242- * If you want an exercise to be skipped when for example a service wasn't
243- enabled for the exercise to be run, you can exit your exercise with the
244- special exitcode 55 and it will be detected as skipped.
245-
246- * The exercise scripts should only use the various OpenStack client binaries to
247- interact with OpenStack. This specifically excludes any ``*-manage `` tools
248- as those assume direct access to configuration and databases, as well as direct
249- database access from the exercise itself.
250-
251- * If specific configuration needs to be present for the exercise to complete,
252- it should be staged in ``stack.sh ``, or called from ``stack.sh ``.
253-
254- * The ``OS_* `` environment variables should be the only ones used for all
255- authentication to OpenStack clients as documented in the CLIAuth _ wiki page.
256-
257- .. _CLIAuth : https://wiki.openstack.org/CLIAuth
258-
259- * The exercise MUST clean up after itself if successful. If it is not successful,
260- it is assumed that state will be left behind; this allows a chance for developers
261- to look around and attempt to debug the problem. The exercise SHOULD clean up
262- or graciously handle possible artifacts left over from previous runs if executed
263- again. It is acceptable to require a reboot or even a re-install of DevStack
264- to restore a clean test environment.
265-
266-
267181Bash Style Guidelines
268182~~~~~~~~~~~~~~~~~~~~~
269183DevStack defines a bash set of best practices for maintaining large
0 commit comments