h_results = hm.RunPhase(constants.HOOKS_PHASE_PRE)
lu.HooksCallBack(constants.HOOKS_PHASE_PRE, h_results,
self._feedback_fn, None)
+
+ if getattr(lu.op, "dry_run", False):
+ # in this mode, no post-hooks are run, and the config is not
+ # written (as it might have been modified by another LU, and we
+ # shouldn't do writeout on behalf of other threads
+ self.LogInfo("dry-run mode requested, not actually executing"
+ " the operation")
+ return lu.dry_run_result
+
try:
result = lu.Exec(self._feedback_fn)
h_results = hm.RunPhase(constants.HOOKS_PHASE_POST)
raise errors.HooksFailure("Communication failure")
for node_name in results:
res = results[node_name]
- if res.failed or res.data is False or not isinstance(res.data, list):
- if not res.offline:
- self.proc.LogWarning("Communication failure to node %s" %
- node_name)
+ if res.offline:
+ continue
+ msg = res.RemoteFailMsg()
+ if msg:
+ self.proc.LogWarning("Communication failure to node %s: %s",
+ node_name, msg)
continue
- for script, hkr, output in res.data:
+ for script, hkr, output in res.payload:
if hkr == constants.HKR_FAIL:
errs.append((node_name, script, output))
if errs:
phase = constants.HOOKS_PHASE_POST
hpath = constants.HOOKS_NAME_CFGUPDATE
nodes = [self.lu.cfg.GetMasterNode()]
- results = self._RunWrapper(nodes, hpath, phase)
+ self._RunWrapper(nodes, hpath, phase)