Commit e843991b authored by Guido Trotter's avatar Guido Trotter

SimpleConfigReader.GetNodeStatusFlags

Adding a way to retrieve the three node status flags, all in one go,
from SimpleConfigReader. Non-existing nodes are handled by returning
"None".
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent ca2a5b13
......@@ -131,6 +131,23 @@ class SimpleConfigReader(object):
def GetClusterSerialNo(self):
return self._config_data["cluster"]["serial_no"]
def GetNodeStatusFlags(self, node):
"""Get a node's status flags
@type node: string
@param node: node name
@rtype: (bool, bool, bool)
@return: (master_candidate, drained, offline) (or None if no such node)
"""
if node not in self._config_data["nodes"]:
return None
master_candidate = self._config_data["nodes"][node]["master_candidate"]
drained = self._config_data["nodes"][node]["drained"]
offline = self._config_data["nodes"][node]["offline"]
return master_candidate, drained, offline
class SimpleStore(object):
"""Interface to static cluster data.
......
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