Add --dry-run

Signed-off-by: Zack Cerza <zack@redhat.com>
This commit is contained in:
Zack Cerza 2015-05-27 09:46:50 -06:00
parent 04b5e6ec09
commit 354a5c297f
2 changed files with 11 additions and 4 deletions

View File

@ -3,10 +3,11 @@ import docopt
import teuthology.nuke
doc = """
usage: teuthology-nuke --help
teuthology-nuke [-v] [--owner OWNER] [-n NAME] [-u] [-i] [-r] [-s]
[-p PID] (-t CONFIG... | -a DIR)
teuthology-nuke [-v] [-u] [-i] [-r] [-s] --owner OWNER --stale
usage:
teuthology-nuke --help
teuthology-nuke [-v] [--owner OWNER] [-n NAME] [-u] [-i] [-r] [-s]
[-p PID] [--dry-run] (-t CONFIG... | -a DIR)
teuthology-nuke [-v] [-u] [-i] [-r] [-s] [--dry-run] --owner OWNER --stale
Reset test machines
@ -19,6 +20,8 @@ optional arguments:
archive path for a job to kill and nuke
--stale attempt to find and nuke 'stale' machines
(e.g. locked by jobs that are no longer running)
--dry-run Don't actually nuke anything; just print the list of
targets that would be nuked
--owner OWNER job owner
-p PID, --pid PID pid of the process to be killed
-r, --reboot-all reboot all machines

View File

@ -384,6 +384,10 @@ def main(args):
ctx.config['targets'],
default_flow_style=False).splitlines()))
if ctx.dry_run:
log.info("Not actually nuking anything since --dry-run was passed")
return
if ctx.owner is None:
ctx.owner = get_user()