Commit 297ddce9 authored by Iustin Pop's avatar Iustin Pop
Browse files

Change semantics of --force-multi for reinstall



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: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 599ee321
......@@ -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>
......
......@@ -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):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment