Commit ebc75510 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

HooksMaster: Add more assertions for variable names

Also replace explicit loop with dict.update.
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent 0306ff62
......@@ -39,6 +39,7 @@ from ganeti import rpc
from ganeti import cmdlib
from ganeti import locking
from ganeti import utils
from ganeti import compat
......@@ -448,10 +449,11 @@ class HooksMaster(object):
if is not None:
lu_env, lu_nodes_pre, lu_nodes_post =
(lu_env, lu_nodes_pre, lu_nodes_post) =
if lu_env:
for key in lu_env:
env["GANETI_" + key] = lu_env[key]
assert not compat.any(key.upper().startswith("GANETI")
for key in lu_env)
env.update(("GANETI_%s" % key, value) for (key, value) in lu_env)
lu_nodes_pre = lu_nodes_post = []
......@@ -472,6 +474,10 @@ class HooksMaster(object):
env = dict([(str(key), str(val)) for key, val in env.iteritems()])
assert compat.all(key == key.upper() and
(key == "PATH" or key.startswith("GANETI_"))
for key in env)
return self.callfn(node_list, hpath, phase, env)
def RunPhase(self, phase, nodes=None):
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