Revision 28b498cd scripts/gnt-cluster

b/scripts/gnt-cluster
542 542
  return 0
543 543

  
544 544

  
545
def _ShowWatcherPause(until):
546
  if until is None or until < time.time():
547
    ToStdout("The watcher is not paused.")
548
  else:
549
    ToStdout("The watcher is paused until %s.", time.ctime(until))
550

  
551

  
545 552
def WatcherOps(opts, args):
546 553
  """Watcher operations.
547 554

  
......
557 564

  
558 565
  if command == "continue":
559 566
    client.SetWatcherPause(None)
567
    ToStdout("The watcher is no longer paused.")
560 568

  
561 569
  elif command == "pause":
562 570
    if len(args) < 2:
563 571
      raise errors.OpPrereqError("Missing pause duration")
564 572

  
565
    until = time.time() + ParseTimespec(args[1])
566
    client.SetWatcherPause(until)
573
    result = client.SetWatcherPause(time.time() + ParseTimespec(args[1]))
574
    _ShowWatcherPause(result)
567 575

  
568 576
  elif command == "info":
569 577
    result = client.QueryConfigValues(["watcher_pause"])
570
    if result is None or result < time.time():
571
      ToStdout("The watcher is not paused.")
572
    else:
573
      ToStdout("The watcher is paused until %s.", time.ctime(result))
578
    _ShowWatcherPause(result)
574 579

  
575 580
  else:
576 581
    raise errors.OpPrereqError("Command '%s' is not valid." % command)

Also available in: Unified diff