Revision ca52cdeb lib/backend.py

b/lib/backend.py
1658 1658
  return result
1659 1659

  
1660 1660

  
1661
def JobQueueUpdate(file_name, content):
1662
  """Updates a file in the queue directory.
1663

  
1664
  """
1665
  queue_dir = os.path.normpath(constants.QUEUE_DIR)
1666
  if os.path.commonprefix([queue_dir, file_name]) != queue_dir:
1667
    logging.error("'%s' is not a file in the queue directory",
1668
                  file_name)
1669
    return False
1670

  
1671
  # Write and replace the file atomically
1672
  utils.WriteFile(file_name, data=content)
1673

  
1674
  return True
1675

  
1676

  
1661 1677
def JobQueuePurge():
1662 1678
  """Removes job queue files and archived jobs
1663 1679

  

Also available in: Unified diff