Commit 8eb148ae authored by Iustin Pop's avatar Iustin Pop

Fix gnt-cluster getmaster on non-master nodes

The current implementation of “gnt-cluster getmaster” doesn't work on
non-master nodes, which is a regression from 1.2. This patch implements
it (again) via ssconf.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarAlexander Schreiber <als@google.com>
parent d1908b41
......@@ -446,6 +446,22 @@ def MasterFailover():
return rcode
def GetMaster():
"""Returns the current master node.
This is a separate function in bootstrap since it's needed by
gnt-cluster, and instead of importing directly ssconf, it's better
to abstract it in bootstrap, where we do use ssconf in other
functions too.
"""
sstore = ssconf.SimpleStore()
old_master, _ = ssconf.GetMasterAndMyself(sstore)
return old_master
def GatherMasterVotes(node_list):
"""Check the agreement on who is the master.
......
......@@ -207,7 +207,8 @@ def ShowClusterMaster(opts, args):
@return: the desired exit code
"""
ToStdout("%s", GetClient().QueryConfigValues(["master_node"])[0])
master = bootstrap.GetMaster()
ToStdout(master)
return 0
......
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