From 354a5c297f5a742699b6b2e614697fd637daa545 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 27 May 2015 09:46:50 -0600 Subject: [PATCH] Add --dry-run Signed-off-by: Zack Cerza --- scripts/nuke.py | 11 +++++++---- teuthology/nuke.py | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/nuke.py b/scripts/nuke.py index d9722b935..53fa51ede 100644 --- a/scripts/nuke.py +++ b/scripts/nuke.py @@ -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 diff --git a/teuthology/nuke.py b/teuthology/nuke.py index af02a6085..bf76bc75e 100644 --- a/teuthology/nuke.py +++ b/teuthology/nuke.py @@ -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() -- 2.47.3