Revision 7b4c1cb9 lib/mcpu.py
b/lib/mcpu.py | ||
---|---|---|
321 | 321 |
hm = HooksMaster(self.rpc.call_hooks_runner, lu) |
322 | 322 |
h_results = hm.RunPhase(constants.HOOKS_PHASE_PRE) |
323 | 323 |
lu.HooksCallBack(constants.HOOKS_PHASE_PRE, h_results, |
324 |
self._Feedback, None)
|
|
324 |
self.Log, None)
|
|
325 | 325 |
|
326 | 326 |
if getattr(lu.op, "dry_run", False): |
327 | 327 |
# in this mode, no post-hooks are run, and the config is not |
... | ... | |
332 | 332 |
return lu.dry_run_result |
333 | 333 |
|
334 | 334 |
try: |
335 |
result = lu.Exec(self._Feedback)
|
|
335 |
result = lu.Exec(self.Log)
|
|
336 | 336 |
h_results = hm.RunPhase(constants.HOOKS_PHASE_POST) |
337 | 337 |
result = lu.HooksCallBack(constants.HOOKS_PHASE_POST, h_results, |
338 |
self._Feedback, result)
|
|
338 |
self.Log, result)
|
|
339 | 339 |
finally: |
340 | 340 |
# FIXME: This needs locks if not lu_class.REQ_BGL |
341 | 341 |
if write_count != self.context.cfg.write_count: |
... | ... | |
470 | 470 |
finally: |
471 | 471 |
self._cbs = None |
472 | 472 |
|
473 |
def _Feedback(self, *args):
|
|
473 |
def Log(self, *args):
|
|
474 | 474 |
"""Forward call to feedback callback function. |
475 | 475 |
|
476 | 476 |
""" |
... | ... | |
482 | 482 |
|
483 | 483 |
""" |
484 | 484 |
logging.debug("Step %d/%d %s", current, total, message) |
485 |
self._Feedback("STEP %d/%d %s" % (current, total, message))
|
|
485 |
self.Log("STEP %d/%d %s" % (current, total, message))
|
|
486 | 486 |
|
487 | 487 |
def LogWarning(self, message, *args, **kwargs): |
488 | 488 |
"""Log a warning to the logs and the user. |
... | ... | |
499 | 499 |
message = message % tuple(args) |
500 | 500 |
if message: |
501 | 501 |
logging.warning(message) |
502 |
self._Feedback(" - WARNING: %s" % message)
|
|
502 |
self.Log(" - WARNING: %s" % message)
|
|
503 | 503 |
if "hint" in kwargs: |
504 |
self._Feedback(" Hint: %s" % kwargs["hint"])
|
|
504 |
self.Log(" Hint: %s" % kwargs["hint"])
|
|
505 | 505 |
|
506 | 506 |
def LogInfo(self, message, *args): |
507 | 507 |
"""Log an informational message to the logs and the user. |
... | ... | |
510 | 510 |
if args: |
511 | 511 |
message = message % tuple(args) |
512 | 512 |
logging.info(message) |
513 |
self._Feedback(" - INFO: %s" % message)
|
|
513 |
self.Log(" - INFO: %s" % message)
|
|
514 | 514 |
|
515 | 515 |
def GetECId(self): |
516 | 516 |
if not self._ec_id: |
Also available in: Unified diff