From 5e96d21692c175839bf6d295c85c332022db1c14 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Tue, 7 Jul 2009 15:23:38 +0200
Subject: [PATCH] ganeti-masterd: allow non-interactive --no-voting

This will be used by ganeti-noded to start ganeti-masterd in a
--no-voting masterfailover.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 daemons/ganeti-masterd | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/daemons/ganeti-masterd b/daemons/ganeti-masterd
index 6a73e4e23..7456d4e6e 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
 
-- 
GitLab