Commit f97a6b10 authored by Iustin Pop's avatar Iustin Pop
Browse files

Remove cfg and sstore parameters to HooksMaster

The HooksMaster class doesn't use the cfg parameter, and it's better to
use it from the LU anyway (if needed). Let's remove it.

Also, the sstore of the LU can be fresher than the sstore we got at init
time, so use that instead and remove our own.

Reviewed-by: imsnah
parent 14e15659
......@@ -116,7 +116,7 @@ class Processor(object):
lu.CheckPrereq()
do_hooks = lu_class.HPATH is not None
if do_hooks:
hm = HooksMaster(rpc.call_hooks_runner, self.cfg, self.sstore, lu)
hm = HooksMaster(rpc.call_hooks_runner, lu)
hm.RunPhase(constants.HOOKS_PHASE_PRE)
result = lu.Exec(feedback_fn)
if do_hooks:
......@@ -145,11 +145,11 @@ class Processor(object):
if lu_class.REQ_CLUSTER and self.cfg is None:
self.cfg = config.ConfigWriter()
self.sstore = ssconf.SimpleStore()
do_hooks = lu_class.HPATH is not None
#do_hooks = lu_class.HPATH is not None
lu = lu_class(self, op, self.cfg, self.sstore)
lu.CheckPrereq()
#if do_hooks:
# hm = HooksMaster(rpc.call_hooks_runner, self.cfg, self.sstore, lu)
# hm = HooksMaster(rpc.call_hooks_runner, lu)
# hm.RunPhase(constants.HOOKS_PHASE_PRE)
result = lu.Exec(feedback_fn)
#if do_hooks:
......@@ -169,10 +169,8 @@ class HooksMaster(object):
which behaves the same works.
"""
def __init__(self, callfn, cfg, sstore, lu):
def __init__(self, callfn, lu):
self.callfn = callfn
self.cfg = cfg
self.sstore = sstore
self.lu = lu
self.op = lu.op
self.hpath = self.lu.HPATH
......@@ -200,9 +198,9 @@ class HooksMaster(object):
for key in lu_env:
env["GANETI_" + key] = lu_env[key]
if self.sstore is not None:
env["GANETI_CLUSTER"] = self.sstore.GetClusterName()
env["GANETI_MASTER"] = self.sstore.GetMasterNode()
if self.lu.sstore is not None:
env["GANETI_CLUSTER"] = self.lu.sstore.GetClusterName()
env["GANETI_MASTER"] = self.lu.sstore.GetMasterNode()
for key in env:
if not isinstance(env[key], str):
......
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