Convert mcpu.py
authorMichael Hanselmann <hansmi@google.com>
Wed, 1 Oct 2008 17:34:32 +0000 (17:34 +0000)
committerMichael Hanselmann <hansmi@google.com>
Wed, 1 Oct 2008 17:34:32 +0000 (17:34 +0000)
Replacing ssconf with configuration.

Reviewed-by: iustinp

lib/mcpu.py
test/mocks.py

index ff5b856..7b65252 100644 (file)
@@ -287,9 +287,9 @@ class HooksMaster(object):
     env = self.env.copy()
     env["GANETI_HOOKS_PHASE"] = phase
     env["GANETI_HOOKS_PATH"] = hpath
-    if self.lu.sstore is not None:
-      env["GANETI_CLUSTER"] = self.lu.sstore.GetClusterName()
-      env["GANETI_MASTER"] = self.lu.sstore.GetMasterNode()
+    if self.lu.cfg is not None:
+      env["GANETI_CLUSTER"] = self.lu.cfg.GetClusterName()
+      env["GANETI_MASTER"] = self.lu.cfg.GetMasterNode()
 
     env = dict([(str(key), str(val)) for key, val in env.iteritems()])
 
@@ -340,7 +340,5 @@ class HooksMaster(object):
     """
     phase = constants.HOOKS_PHASE_POST
     hpath = constants.HOOKS_NAME_CFGUPDATE
-    if self.lu.sstore is None:
-      raise errors.ProgrammerError("Null sstore on config update hook")
-    nodes = [self.lu.sstore.GetMasterNode()]
+    nodes = [self.lu.cfg.GetMasterNode()]
     results = self._RunWrapper(nodes, hpath, phase)
index 442709c..c611285 100644 (file)
@@ -48,6 +48,12 @@ class FakeConfig:
     def GetHostKey(self):
         return FAKE_CLUSTER_KEY
 
+    def GetClusterName(self):
+        return "test.cluster"
+
+    def GetMasterNode(self):
+        return utils.HostInfo().name
+
 
 class FakeSStore:
     """Fake simplestore object"""