On Tue, Jul 07, 2009 at 03:51:45PM +0200, Guido Trotter wrote:
> 
> This will be used by ganeti-noded to start ganeti-masterd in a
> --no-voting masterfailover.
> 
> Signed-off-by: Guido Trotter <[email protected]>
> ---
>  daemons/ganeti-masterd |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/daemons/ganeti-masterd b/daemons/ganeti-masterd
> index 6a73e4e..7456d4e 100755
> --- a/daemons/ganeti-masterd
> +++ b/daemons/ganeti-masterd
> @@ -396,6 +396,10 @@ def ParseOptions():
>                      help="Do not check that the nodes agree on this node"
>                      " being the master and start the daemon unconditionally",
>                      default=False, action="store_true")
> +  parser.add_option("--yes-do-it", dest="yes_do_it",
> +                    help="Override interactive check for --no-voting",
> +                    default=False, action="store_true")
> +
>    options, args = parser.parse_args()
>    return options, args
>  
> @@ -472,7 +476,7 @@ def main():
>      ssconf.CheckMaster(options.debug)
>  
>      # we believe we are the master, let's ask the other nodes...
> -    if options.no_voting:
> +    if options.no_voting and not options.yes_do_it:
>        sys.stdout.write("The 'no voting' option has been selected.\n")
>        sys.stdout.write("This is dangerous, please confirm by"
>                         " typing uppercase 'yes': ")
> @@ -481,7 +485,7 @@ def main():
>        if confirmation != "YES":
>          print "Aborting."
>          return
> -    else:
> +    elif not options.no_voting:
>        if not CheckAgreement():
>          return

I can't see the whole if here, but are you sure this if branch is
correct? I would have expected more:

if options.no_voting:
  if not options.yes_do_it:
    ask for confirmation
else:
  if not check agreement(): return

Anyway, LGTM if this works as expected.

iustin

Reply via email to