-#!/usr/bin/python
+#
#
# Copyright (C) 2006, 2007 Google Inc.
_SS_FILEPREFIX = "ssconf_"
SS_HYPERVISOR = "hypervisor"
SS_NODED_PASS = "node_pass"
- _VALID_KEYS = (SS_HYPERVISOR, SS_NODED_PASS,)
+ SS_MASTER_NODE = "master_node"
+ SS_MASTER_IP = "master_ip"
+ SS_MASTER_NETDEV = "master_netdev"
+ SS_CLUSTER_NAME = "cluster_name"
+ _VALID_KEYS = (SS_HYPERVISOR, SS_NODED_PASS, SS_MASTER_NODE, SS_MASTER_IP,
+ SS_MASTER_NETDEV, SS_CLUSTER_NAME)
_MAX_SIZE = 4096
def __init__(self, cfg_location=None):
"""
if key not in self._VALID_KEYS:
- raise errors.ProgrammerError, ("Invalid key requested from SSConf: '%s'"
- % str(key))
+ raise errors.ProgrammerError("Invalid key requested from SSConf: '%s'"
+ % str(key))
filename = self._cfg_dir + '/' + self._SS_FILEPREFIX + key
return filename
finally:
fh.close()
except EnvironmentError, err:
- raise errors.ConfigurationError, ("Can't read from the ssconf file:"
- " '%s'" % str(err))
+ raise errors.ConfigurationError("Can't read from the ssconf file:"
+ " '%s'" % str(err))
self._cache[key] = data
return data
"""
return self._ReadFile(self.SS_NODED_PASS)
+ def GetMasterNode(self):
+ """Get the hostname of the master node for this cluster.
+
+ """
+ return self._ReadFile(self.SS_MASTER_NODE)
+
+ def GetMasterIP(self):
+ """Get the IP of the master node for this cluster.
+
+ """
+ return self._ReadFile(self.SS_MASTER_IP)
+
+ def GetMasterNetdev(self):
+ """Get the netdev to which we'll add the master ip.
+
+ """
+ return self._ReadFile(self.SS_MASTER_NETDEV)
+
+ def GetClusterName(self):
+ """Get the cluster name.
+
+ """
+ return self._ReadFile(self.SS_CLUSTER_NAME)
+
def SetKey(self, key, value):
"""Set the value of a key.