diff --git a/lib/mcpu.py b/lib/mcpu.py index ff5b856ac2e2bf146fb36fc7dbf305c8b1c22db9..7b65252cf9e77554380026b8b4d93c8e051f36ce 100644 --- a/lib/mcpu.py +++ b/lib/mcpu.py @@ -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) diff --git a/test/mocks.py b/test/mocks.py index 442709c155716f4c49f4f4605cd7245f4d676ebf..c611285564bd08eae5a0653ff92bcda3a0ed686a 100644 --- a/test/mocks.py +++ b/test/mocks.py @@ -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"""