Revision 99e222b1 lib/backend.py

b/lib/backend.py
64 64
from ganeti import compat
65 65
from ganeti import pathutils
66 66
from ganeti import vcluster
67
from ganeti import ht
67 68

  
68 69

  
69 70
_BOOT_ID_PATH = "/proc/sys/kernel/random/boot_id"
......
3768 3769
      lock = None
3769 3770

  
3770 3771

  
3772
def SetWatcherPause(until, _filename=pathutils.WATCHER_PAUSEFILE):
3773
  """Creates or removes the watcher pause file.
3774

  
3775
  @type until: None or number
3776
  @param until: Unix timestamp saying until when the watcher shouldn't run
3777

  
3778
  """
3779
  if until is None:
3780
    logging.info("Received request to no longer pause watcher")
3781
    utils.RemoveFile(_filename)
3782
  else:
3783
    logging.info("Received request to pause watcher until %s", until)
3784

  
3785
    if not ht.TNumber(until):
3786
      _Fail("Duration must be numeric")
3787

  
3788
    utils.WriteFile(_filename, data="%d\n" % (until, ), mode=0644)
3789

  
3790

  
3771 3791
class HooksRunner(object):
3772 3792
  """Hook runner.
3773 3793

  

Also available in: Unified diff