Revision 17e82923

b/lib/mcpu.py
333 333

  
334 334
    return self.callfn(node_list, hpath, phase, env)
335 335

  
336
  def RunPhase(self, phase):
336
  def RunPhase(self, phase, nodes=None):
337 337
    """Run all the scripts for a phase.
338 338

  
339 339
    This is the main function of the HookMaster.
340 340

  
341 341
    @param phase: one of L{constants.HOOKS_PHASE_POST} or
342 342
        L{constants.HOOKS_PHASE_PRE}; it denotes the hooks phase
343
    @param nodes: overrides the predefined list of nodes for the given phase
343 344
    @return: the processed results of the hooks multi-node rpc call
344 345
    @raise errors.HooksFailure: on communication failure to the nodes
345 346

  
346 347
    """
347
    if not self.node_list[phase]:
348
    if not self.node_list[phase] and not nodes:
348 349
      # empty node list, we should not attempt to run this as either
349 350
      # we're in the cluster init phase and the rpc client part can't
350 351
      # even attempt to run, or this LU doesn't do hooks at all
351 352
      return
352 353
    hpath = self.lu.HPATH
353
    results = self._RunWrapper(self.node_list[phase], hpath, phase)
354
    if nodes is not None:
355
      results = self._RunWrapper(nodes, hpath, phase)
356
    else:
357
      results = self._RunWrapper(self.node_list[phase], hpath, phase)
354 358
    if phase == constants.HOOKS_PHASE_PRE:
355 359
      errs = []
356 360
      if not results:

Also available in: Unified diff