Commit f86426f5 authored by Iustin Pop's avatar Iustin Pop
Browse files

gnt-instance reinstall: display OS changes



Currently, when reinstalling an instance, especially when selecting an
OS interactively, is hard to be sure one has chosen the correct OS.

This patch adds displaying the selected OS. I'm not entirely happy, as
it's not very good English (e.g. keeping the same OS should be "but
keep the same OS", and changing should be "and also change …") but I
didn't find a better handling of all the cases:

node1# gnt-instance reinstall -o lenny-image+default instance1
This will reinstall the instance 'instance1' (and change the OS to
'lenny-image+default') which removes all data. Continue?
y/[n]/?: n

node1# gnt-instance reinstall instance1
This will reinstall the instance 'instance1' (and keep the same OS)
which removes all data. Continue?
y/[n]/?: n

node1# gnt-instance reinstall instance1 instance2
The reinstall will operate on 2 instances.
Note: this will remove *all* data for the below instances! It will
keep the same OS.
Do you want to continue?

node1# gnt-instance reinstall -o lenny-image+default instance1
instance2
The reinstall will operate on 2 instances.
Note: this will remove *all* data for the below instances! It will
change the OS to 'lenny-image+default'.
Do you want to continue?
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 65a77fab
......@@ -443,22 +443,28 @@ def ReinstallInstance(opts, args):
return 1
os_name = selected
os_msg = "change the OS to '%s'" % selected
else:
os_name = opts.os
if opts.os is not None:
os_msg = "change the OS to '%s'" % os_name
else:
os_msg = "keep the same OS"
# 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"
warn_msg = ("Note: this will remove *all* data for the"
" below instances! It will %s.\n" % os_msg)
if not (opts.force_multi or
ConfirmOperation(inames, "instances", "reinstall", extra=warn_msg)):
return 1
else:
if not (opts.force or opts.force_multi):
usertext = ("This will reinstall the instance %s and remove"
" all data. Continue?") % inames[0]
usertext = ("This will reinstall the instance '%s' (and %s) which"
" removes all data. Continue?") % (inames[0], os_msg)
if not AskUser(usertext):
return 1
......
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