From 297ddce9b81f281832846bb27b7ae20abceaad5e Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 29 Jul 2010 18:13:58 -0400 Subject: [PATCH] Change semantics of --force-multi for reinstall MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, we require both --force and --force-multiple for skipping the confirmation on instance reinstalls. After offline conversations, this has been deemed to be excessive, and this patch changes the meaning of --force-multiple to be a βstrongerβ force, and not require both. So, to skip the prompts: - single instance reinstallation requires either --force or --force-multiple - multiple instance reinstallation requires --force-multiple Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- man/gnt-instance.sgml | 3 +-- scripts/gnt-instance | 9 +++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/man/gnt-instance.sgml b/man/gnt-instance.sgml index dd88052bd..60d83158b 100644 --- a/man/gnt-instance.sgml +++ b/man/gnt-instance.sgml @@ -1633,8 +1633,7 @@ instance5: 11225 are selected (either by passing multiple arguments or by using the <option>--node</option>, <option>--primary</option>, <option>--secondary</option> or - <option>--all</option> options), the user must pass both the - <option>--force</option> and + <option>--all</option> options), the user must pass the <option>--force-multiple</option> options to skip the interactive confirmation. </para> diff --git a/scripts/gnt-instance b/scripts/gnt-instance index ec19602ca..75ecd63e8 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -559,16 +559,17 @@ def ReinstallInstance(opts, args): else: os_name = opts.os - # third, get confirmation: multi-reinstall requires --force-multi - # *and* --force, single-reinstall just --force + # third, get confirmation: multi-reinstall requires --force-multi, + # single-reinstall either --force or --force-multi (--force-multi is + # a stronger --force) multi_on = opts.multi_mode != _SHUTDOWN_INSTANCES or len(inames) > 1 if multi_on: warn_msg = "Note: this will remove *all* data for the below instances!\n" - if not ((opts.force_multi and opts.force) or + if not (opts.force_multi or _ConfirmOperation(inames, "reinstall", extra=warn_msg)): return 1 else: - if not opts.force: + if not (opts.force or opts.force_multi): usertext = ("This will reinstall the instance %s and remove" " all data. Continue?") % inames[0] if not AskUser(usertext): -- GitLab