Commit 4b5e8271 authored by Iustin Pop's avatar Iustin Pop
Browse files

Remove extra argument from HooksMaster class

The class needs to have a proc attribute/argument to
init in ordet to call its LogWarning method. However, this is available
from the 'lu' attribute, so we can remove this dependency.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent 4dce1a83
......@@ -117,7 +117,7 @@ class Processor(object):
write_count = self.context.cfg.write_count
hm = HooksMaster(self.rpc.call_hooks_runner, self, lu)
hm = HooksMaster(self.rpc.call_hooks_runner, lu)
h_results = hm.RunPhase(constants.HOOKS_PHASE_PRE)
lu.HooksCallBack(constants.HOOKS_PHASE_PRE, h_results,
self._feedback_fn, None)
......@@ -282,9 +282,8 @@ class HooksMaster(object):
which behaves the same works.
def __init__(self, callfn, proc, lu):
def __init__(self, callfn, lu):
self.callfn = callfn
self.proc = proc = lu
self.op = lu.op
self.env, node_list_pre, node_list_post = self._BuildEnv()
......@@ -361,8 +360,8 @@ class HooksMaster(object):
msg = res.RemoteFailMsg()
if msg:
self.proc.LogWarning("Communication failure to node %s: %s",
node_name, msg)"Communication failure to node %s: %s",
node_name, msg)
for script, hkr, output in res.payload:
if hkr == constants.HKR_FAIL:
......@@ -240,14 +240,14 @@ class TestHooksMaster(unittest.TestCase):
def testTotalFalse(self):
"""Test complete rpc failure"""
hm = mcpu.HooksMaster(self._call_false, FakeProc(),
hm = mcpu.HooksMaster(self._call_false,
hm.RunPhase, constants.HOOKS_PHASE_PRE)
def testIndividualFalse(self):
"""Test individual node failure"""
hm = mcpu.HooksMaster(self._call_nodes_false, FakeProc(),
hm = mcpu.HooksMaster(self._call_nodes_false,
# hm.RunPhase, constants.HOOKS_PHASE_PRE)
......@@ -255,14 +255,14 @@ class TestHooksMaster(unittest.TestCase):
def testScriptFalse(self):
"""Test individual rpc failure"""
hm = mcpu.HooksMaster(self._call_script_fail, FakeProc(),
hm = mcpu.HooksMaster(self._call_script_fail,
hm.RunPhase, constants.HOOKS_PHASE_PRE)
def testScriptSucceed(self):
"""Test individual rpc failure"""
hm = mcpu.HooksMaster(self._call_script_succeed, FakeProc(),
hm = mcpu.HooksMaster(self._call_script_succeed,
for phase in (constants.HOOKS_PHASE_PRE, constants.HOOKS_PHASE_POST):
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