Enhancement of tempest cleanup documentation

Some editorial changes around the "tempest cleanup" command
such as specifying the name of the command in the documentation
as well as suggested usage.

Change-Id: I30ddd660f7ecce5a10457671c48033be3eacf71d
This commit is contained in:
Dustin Schoenbrun 2017-03-09 18:54:03 -05:00
parent ebb74eb2df
commit d4d8346fad

View File

@ -14,41 +14,61 @@
# under the License.
"""
Utility for cleaning up environment after Tempest run
Utility for cleaning up environment after Tempest test run
**Usage:** ``tempest cleanup [--help] [OPTIONS]``
If run with no arguments, ``tempest cleanup`` will query your OpenStack
deployment and build a list of resources to delete and destroy them. This list
will exclude the resources from ``saved_state.json`` and will include the
configured admin account if the ``--delete-tempest-conf-objects`` flag is
specified. By default the admin project is not deleted and the admin user
specified in ``tempest.conf`` is never deleted.
Example Run
-----------
**WARNING: If step 1 is skipped in the example below, the cleanup procedure
may delete resources that existed in the cloud before the test run. This
may cause an unwanted destruction of cloud resources, so use caution with
this command.**
``$ tempest cleanup --init-saved-state``
``$ # Actual running of Tempest tests``
``$ tempest cleanup``
Runtime Arguments
-----------------
**--init-saved-state**: Before you can execute cleanup you must initialize
the saved state by running it with the **--init-saved-state** flag
(creating ./saved_state.json), which protects your deployment from
cleanup deleting objects you want to keep. Typically you would run
cleanup with **--init-saved-state** prior to a tempest run. If this is not
the case saved_state.json must be edited, removing objects you want
cleanup to delete.
**--init-saved-state**: Initializes the saved state of the OpenStack deployment
and will output a ``saved_state.json`` file containing resources from your
deployment that will be preserved from the cleanup command. This should be
done prior to running Tempest tests.
**--dry-run**: Creates a report (dry_run.json) of the tenants that will be
cleaned up (in the "_tenants_to_clean" array), and the global objects
that will be removed (tenants, users, flavors and images). Once
cleanup is executed in normal mode, running it again with **--dry-run**
should yield an empty report.
**--delete-tempest-conf-objects**: If option is present, then the command will
delete the admin project in addition to the resources associated with them on
clean up. If option is not present, the command will delete the resources
associated with the Tempest and alternate Tempest users and projects but will
not delete the projects themselves.
**NOTE**: The _tenants_to_clean array in dry-run.json lists the
tenants that cleanup will loop through and delete child objects, not
delete the tenant itself. This may differ from the tenants array as you
can clean the tempest and alternate tempest tenants but by default,
cleanup deletes the objects in the tempest and alternate tempest tenants
but does not delete those tenants unless the **--delete-tempest-conf-objects**
flag is used to force their deletion.
**--dry-run**: Creates a report (``./dry_run.json``) of the projects that will
be cleaned up (in the ``_tenants_to_clean`` dictionary [1]_) and the global
objects that will be removed (domains, flavors, images, roles, projects,
and users). Once the cleanup command is executed (e.g. run without
parameters), running it again with **--dry-run** should yield an empty report.
**Normal mode**: running with no arguments, will query your deployment and
build a list of objects to delete after filtering out the objects found in
saved_state.json and based on the **--delete-tempest-conf-objects** flag.
**--help**: Print the help text for the command and parameters.
By default the tempest and alternate tempest users and tenants are not
deleted and the admin user specified in tempest.conf is never deleted.
.. [1] The ``_tenants_to_clean`` dictionary in ``dry_run.json`` lists the
projects that ``tempest cleanup`` will loop through to delete child
objects, but the command will, by default, not delete the projects
themselves. This may differ from the ``tenants`` list as you can clean
the Tempest and alternate Tempest users and projects but they will not be
deleted unless the **--delete-tempest-conf-objects** flag is used to
force their deletion.
Please run with **--help** to see full list of options.
"""
import sys
import traceback